White border line on toolstrip when the render mode is Set to System.
-
Friday, September 14, 2012 12:47 PM
Hello Everyone,
I am using toolstrip control but when i set the render mode of tool strip to System.a white border is coming at bottom of toolstrip.i have no idea how to remove that border or fill it with a color similar to back color of toolstrip.Looking forward for suggestions.
Thanks & Regards,
Natiq
All Replies
-
Friday, September 14, 2012 1:21 PM
On the form where you have put toolstrip, first put a container for that, either you put a SPlitCOntainer or TableLayoutPanel somthing like that and then you put a ToolstripCOntainer and Dock it to the container.
Regards, ManjunathRV http://manjunathrv.wordpress.com/
-
Friday, September 14, 2012 1:28 PM
Hi Manjunath,
it is not related to that i think because i am still getting that border.
Thanks & Regards,
Natiq
-
Wednesday, September 19, 2012 3:55 AMModerator
Hi Syed,
Are there some requirements for you to set the RenderMode to System?
Base on my understanding, the write line is by default and we cannot paint on it. I have created a render class derived from ToolStripSystemRenderer and override the OnRenderToolStripBackground.
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { base.OnRenderToolStripBackground(e); Graphics g = e.Graphics; g.DrawLine(Pens.Purple, new Point(e.AffectedBounds.X, e.AffectedBounds.Height), new Point(e.AffectedBounds.Height, 0)); }The Height of the toolStrip is 25, however there are only 23 pixels paint on the toolStrip.
If you have some special requirement, I think you may try to create your custom ToolStripRenderer.
http://msdn.microsoft.com/en-us/library/ms229720.aspx
Best regards,
Chester Hong
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Edited by Chester HongMicrosoft Contingent Staff, Moderator Wednesday, September 19, 2012 3:56 AM
-
Wednesday, September 19, 2012 12:14 PM
Hi Chester Hong,
There are no special requirements to set renderMode to System. but i overcame this border issue by creating a class derived from ToolStripSystemRenderer and suppressing the call to OnRenderToolstripBorder() method for my toolstrip.
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
{if(e->ToolStrip->Name != "MyToolStrip")
{
base.OnRenderToolStripBorder(e);}
}Thanks & Regards,
Natiq
- Marked As Answer by Chester HongMicrosoft Contingent Staff, Moderator Thursday, September 20, 2012 10:39 AM
-
Thursday, September 20, 2012 10:43 AMModerator
Thanks for sharing your solution.
In fact I have tried to override OnRenderToolStripBorder before I use OnRenderToolStripBackground. But it seems that there are some reason it does not work on my machine..
I'm glad to hear you get it work.
Have a nice day!
Chester Hong
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.


