NTabControl with NTabControlRenderer doesn't work


https://www.nevron.com/Forum/Topic6766.aspx
Print Topic | Close Window

By Craig Swearingen - 12 Years Ago

I've added a custom NTabControlRenderer to my NTabControl so I can paint the tab background the mouse over highlight color at times.  I've overridden the DrawTabBackground method to do this drawing.

It doesn't get called when the application has a skin (i.e. like MacOS).  It works as expected when there is no skin.

Is there any way I can make this work with a skin?

By Nevron Support - 12 Years Ago
Hi Craig,

Here is the source of the original DrawTabBackground:

protected virtual void DrawTabBackground(Graphics g)
{
   if(m_Skin != null)
   {
      if(DrawSkinBackground(g))
         return;
   }

   switch(m_Tab.m_Info.Style)
   {
      case TabStyle.Standard:
         DrawTabStandardBackground(g);
         break;
      case TabStyle.Buttons:
         DrawTabButtonsBackground(g);
         break;
      case TabStyle.MultiDocument:
         DrawTabMultiDocBackground(g);
         break;
   }
}

May be better solution will be to override DrawTabStandardBackground if you use only standard tab style, and DrawSkinBackgorund methods.
By Craig Swearingen - 12 Years Ago
Thanks for the tip.  I tried also overriding the DrawSkinBackground and I was able to get this event when a skin was present and do a different highlight.  I think that can work for now.