locked
Custom Tab control refreshing issue RRS feed

  • Question

  • I am using VS2008 and developing an application in C#-WinForms

    I have customized a tabcontrol by overriding the DrawItem(...) function. The idea is to have a different color for tab headers than what is available in "Normal" mode. The following were the 3 issues...

    1. The non client area of the tab control...i.e the top strip other than area where  the tab page headers are present is painted with (white) system color which i cannot change it. Therefore i used below code to fill it with my favourite color....No issues.....but whenever any dialogbox is overlapping on this area (non-client area), the area doesnt get refreshed, the client area of the tab pages gets refreshed properly. I am not sure what event i should handle and how to redraw the tabcontrol or is it just a simple property setting or should i overide some other function apart from DrawItem(...) to ensure proper refreshing etc...


    Rectangle rc = tabControl1.ClientRectangle;

    g.FillRectangle(tabNCBrush, rc);


    2. Whenever the form refreshes and the tabcontrol is redrawn, i could see that the non-client area is drawn with the system color (white) first and immediately changed to the custom color...this gives a frustrating flickering effect....How to avoid this flickering?

    3. Since i am overiding the DrawItem(...) method...when a tabpage is selected, the visual highlighting of the page header (i.e the tab) is awkward....i.e if you imagine the tab as a rectangular area, which it is now, the top and left border are thick white (system color) which gives a ugly look and feel.

    Suggestions and pointers to solutions will be greatly appreciated.

    Thanks in advance

    Rao

    • Moved by ashawani_dubey Wednesday, June 10, 2009 6:44 AM not related (From:Social Bookmarks Discussion Forum)
    Wednesday, June 10, 2009 6:21 AM

Answers

  • Hi

    thanks..... i have moved the question to the appropriate forum u suggested.

    regards
    Rao
    Friday, June 12, 2009 5:46 AM

All replies