a_jam_sandwich Posted March 21, 2003 Posted March 21, 2003 Owner Draw Quote Code today gone tomorrow!
aewarnick Posted March 21, 2003 Author Posted March 21, 2003 I'll have to learn how to do that. Like your quote, but it needs a comma after .NOT. Quote C#
aewarnick Posted March 22, 2003 Author Posted March 22, 2003 I have been trying all day long to draw the toolbar background red but to no avail. The OnPaint event is not ever called when I inherit from ToolBar. But when I inherit from UserControl or Button the OnPaint event is fired, but that is pretty useless to me because it is not anything like a toolbar. And, the ToolBar in VS does not have a DrawMode option for it. So I cannot Owner Draw. I don't think so anyway. It seems like I would have to create my own toolbar control from scratch. What do you think? Quote C#
*Gurus* divil Posted March 22, 2003 *Gurus* Posted March 22, 2003 The answer is probably. The Toolbar in the .NET framework is not a complete control in itself, it only wraps the win32 common controls toolbar. This won't always be the case, but that's how it is at the moment. That means that you almost certainly won't be able to owner draw it in any elegant way. The only way you'd be able to owner draw it is to override its WndProc method and listen for the WM_PAINT message. You might be able to do some more stuff specific to the toolbar by sending it messages and creating win32 brush objects for it when it asks for them. Creating your own toolbar from scratch will probably be about as much work, and give you far more control (obviously). I've written my own, which works well. It does more than the win32 one does. You might want to read the article I wrote on writing collection-driven controls like this, it goes in to the best way to design them. The sample project that comes with it could be converted to a functioning toolbar quite easily. Read it here 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 March 23, 2003 Author Posted March 23, 2003 Divil, I found a small mistake in your page: but in this case we want to hide then. (them) That is under the Adding the designer section. Here is another one: Adding Buttons The first thing we want the user to be able to do is to buttons. Quote C#
*Gurus* divil Posted March 23, 2003 *Gurus* Posted March 23, 2003 Thanks 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.