Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I created my own custom tab control inheriting from TabControl. I have it in one of my programs and it is painted but my override of the OnPaint event does not even enter.

 

protected override void OnPaint(PaintEventArgs e)

 

OnResize works but not OnPaint. Why?

Edited by aewarnick
C#
  • *Gurus*
Posted
That control is drawn by Windows, not any .NET code, so overriding that method is pretty much useless unfortunately. To draw it yourself you would have to intercept the WM_PAINT message and send the control various messages to find out the bounds of everything.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

Does that mean that I will have to draw the whole thing, or can I just paint on the ClientRectange a different color. Either transparent or gradient?

 

And if you would, could you direct me to some sample code of doing this thing?

C#
  • *Gurus*
Posted

I have no experience ownerdrawing tabcontrols, perhaps someone else will chip in.

 

If you're after a way to make the tabcontrol client background gradiented properly under windows xp, there is a replacement control out there which does it correctly.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...