winforms - C# Form Button Padding -
in c# form i'am trying make nicely looking button cant on text "padding" problem.
i made mind of how should can't achieve it. supposed flat button black borders , "options" text in (like on second picture). kind of "padding" hides pretty big part of text.
changing font size kinda helped want perserve button's ~16px height , font small can fit in there unreadable.
i've tried setting button's padding property 0. thinking workaround overriding onpaint event / making multiple controls (like, combine label) i'am worried performance impact.
hm took shot @ it, best do.
i used image flat button, border providing grey area beyond black border. sort of workaround. whatever.
here image button background .
and code button:
// // button1 // this.button1.backcolor = system.drawing.color.fromargb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.button1.backgroundimage = ((system.drawing.image)(resources.getobject("button1.backgroundimage"))); this.button1.backgroundimagelayout = system.windows.forms.imagelayout.stretch; this.button1.flatappearance.bordercolor = system.drawing.color.fromargb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.button1.flatappearance.bordersize = 4; this.button1.flatappearance.mousedownbackcolor = system.drawing.color.silver; this.button1.flatappearance.mouseoverbackcolor = system.drawing.color.fromargb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); this.button1.flatstyle = system.windows.forms.flatstyle.flat; this.button1.font = new system.drawing.font("verdana", 6.75f, system.drawing.fontstyle.regular, system.drawing.graphicsunit.point, ((byte)(0))); this.button1.forecolor = system.drawing.color.white; this.button1.imagealign = system.drawing.contentalignment.topcenter; this.button1.location = new system.drawing.point(94, 124); this.button1.name = "button1"; this.button1.size = new system.drawing.size(61, 28); this.button1.tabindex = 0; this.button1.text = "options"; this.button1.textalign = system.drawing.contentalignment.topleft; this.button1.usevisualstylebackcolor = false;
Comments
Post a Comment