aewarnick Posted May 23, 2003 Posted May 23, 2003 (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 May 23, 2003 by aewarnick Quote C#
*Gurus* divil Posted May 24, 2003 *Gurus* Posted May 24, 2003 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
aewarnick Posted May 24, 2003 Author Posted May 24, 2003 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? Quote C#
*Gurus* divil Posted May 24, 2003 *Gurus* Posted May 24, 2003 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
aewarnick Posted May 26, 2003 Author Posted May 26, 2003 I take it that for each control there are different messages sent and not just a standard for everything? Quote C#
*Gurus* divil Posted May 26, 2003 *Gurus* Posted May 26, 2003 It's always WM_PAINT sent to paint it, but that's not much use without the other messages that _you_ send to the control to get or set the bounds of everything so you know where to paint. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.