c# - How to avoid 3 pixel gap on left of ToolStrip in Winforms? -
i'm using windows 7 , winforms/c#.
when add together toolstrip toolstrip container, 3 pixels of space left of toolstrip. if set location 0,0, resets 3,0. here image demonstrate this:
how can avoid this? i've set padding , margin of toolstripcontainer 0, , experimented different rendermodes, nil seems help. ideas?
public form1() { initializecomponent(); this.toolstripcontainer1.toptoolstrippanel.rowmargin = new padding(0); }
just have set rowmargin property of toolstrippanels within toolstripcontainer. not available in designer needs set in code seen above. apparently default, left property of rowmargin set 3. why location not changing when set 0.
result:
edit: seems i've sparked own curiosity. i'm trying see if can rid of 2 pixel gap @ bottom. 1 seems lot harder track downwards far.
edit 2: ok figured out. beingness done the toolstrip's renderer. in example, using system rendermode, added new class in project inherits toolstripsystemrenderer , overrode onrendertoolstripborder method , commented out phone call base of operations method.
using system.windows.forms; namespace windowsformsapplication1 { public class mytoolstripsystemrenderer : toolstripsystemrenderer { protected override void onrendertoolstripborder(toolstriprendereventargs e) { //base.onrendertoolstripborder(e); } } } added line in form's constructor assign custom renderer.
public form1() { initializecomponent(); this.toolstrip1.renderer = new mytoolstripsystemrenderer(); this.toolstripcontainer1.toptoolstrippanel.rowmargin = new padding(0); } result:
edit 3: found out today known bug toolstripsystemrenderer. suppose didn't find because thinking had toolstripcontainer. anyway, helps, here's question regarding "border" of toolstrip. http://stackoverflow.com/a/2060360/2056131
c# winforms margin padding toolstrip
No comments:
Post a Comment