Reputation: 54100
I'm using WinForms : C# .NET.
I'm facing a problem with ContextMenuStrip
and Toolstrip
. Visual Stuido's Property editor is not letting me to change the property I want.
Here is the snapshot of how I want my ContextMenuStrip
to looklike & same is the case with Toolstrip
. I don't understand how to do this.
If I need to learn something, please suggest appropriate good material (tutorials, articles etc.)
alt text http://f.imagehost.org/0289/KproxyChecker.jpg
Upvotes: 1
Views: 203
Reputation: 887365
There is no single property that you can set to make a ContextMenuStrip
look like that.
You need to create your own ToolStripRenderer
class that paints menus like that, then set the Renderer
property of the ContextMenuStrip to an instance of your ToolStripRenderer
.
Good luck.
EDIT: You can find sample code here.
Upvotes: 2
Reputation: 941347
You'll have to assign the Renderer property to a class that renders the CMS or tool strip the way you want it. Use this code as a template to get started:
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
contextMenuStrip1.Renderer = new myRenderer();
}
class myRenderer : ToolStripProfessionalRenderer {
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) {
// Replace this with your own drawing code...
base.OnRenderToolStripBackground(e);
}
}
}
Upvotes: 3