c# - How to remove dotted focus rectangle from tab control? -
i'm trying remove dotted focus rectangle custom tab control
. i've tried , not remove rectangle.
as can see in picture, focus rectangle disturbing in application design.
please help!
to remove focus cue, have set userpaint
true, , paint entire tab control yourself, including borders, text, backgrounds, highlighting, hot-tracking, etc.
the following code paints tab text , background:
public class tc2 : tabcontrol { public tc2() { this.setstyle(controlstyles.allpaintinginwmpaint | controlstyles.optimizeddoublebuffer | controlstyles.resizeredraw | controlstyles.userpaint, true); } protected override void onpaint(painteventargs e) { base.onpaint(e); var g = e.graphics; tabpage currenttab = this.selectedtab; (int = 0; < tabpages.count; i++) { tabpage tp = tabpages[i]; rectangle r = gettabrect(i); brush b = (tp == currenttab ? brushes.lightsteelblue : brushes.lightgray); g.fillrectangle(b, r); textrenderer.drawtext(g, tp.text, tp.font, r, tp.forecolor); } } protected override void onpaintbackground(painteventargs e) { base.onpaintbackground(e); } }
Comments
Post a Comment