double buffering problem subsequent owner-drawn tabcontrol?


i have subsequent tabcontrol demonstrate purpose enabling double buffering, solely zero operative expected. here tabcontrol code:



class doublebufferedtabcontrol : tabcontrol
{
open doublebufferedtabcontrol() : base()
{
this.doublebuffered = true;
this.setstyle
(
controlstyles.userpaint |
controlstyles.allpaintinginwmpaint |
controlstyles.resizeredraw |
controlstyles.optimizeddoublebuffer |
controlstyles.supportstransparentbackcolor,
false
);
}
}


this tabcontrol following set it's pull mode 'ownerdrawnfixed' i altered colours. here tradition sketch method:



    private vacant navigation_pagecontent_drawitem(object sender, drawitemeventargs e)
{
//structure.
graphics g = e.graphics;
tabcontrol t = (tabcontrol)sender;
tabpage currentpage = t.tabpages[e.index];

//get tide tab
rectangle currenttabrect = t.gettabrect(e.index);

//get final tab.
rectangle lasttab = t.gettabrect(t.tabpages.count - 1);

//main credentials rectangle.
rectangle backgroundrect = new rectangle(lasttab.width, t.bounds.y - 4, t.width - (lasttab.width), t.height);

//tab credentials rectangle.
rectangle tabbackgroundrect = new rectangle(0, lasttab.y + lasttab.height, lasttab.width, t.bounds.height - (lasttab.y + lasttab.height));

//set anitialiasing text.
e.graphics.textrenderinghint = system.drawing.text.textrenderinghint.cleartypegridfit;

//string format text.
stringformat stringformat = new stringformat();
stringformat.alignment = stringalignment.center;
stringformat.linealignment = stringalignment.center;

//fill background.
g.fillrectangle(brushes.lightgray, backgroundrect);
g.fillrectangle(brushes.bisque, tabbackgroundrect);

//draw comparison tab.
if(e.state == drawitemstate.selected)
{
g.fillrectangle(brushes.white, e.bounds);
rectangle selectedtaboutline = new rectangle(e.bounds.x + 2, e.bounds.y + 2, e.bounds.width, e.bounds.height - 4);
g.drawrectangle(new pen(brushes.lightgray, 4f), selectedtaboutline);
g.drawstring(currentpage.text, new font("arial", 12f, fontstyle.bold, graphicsunit.point), new solidbrush(color.fromargb(70, 70, 70)), currenttabrect, stringformat);
}
else
{
g.fillrectangle(new solidbrush(color.fromargb(230, 230, 230)), e.bounds);
g.drawstring(currentpage.text, new font("arial", 12f, fontstyle.regular, graphicsunit.point), brushes.gray, currenttabrect, stringformat);
}

}


all service however, control double buffered still flickers resized.



any ideas?



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members