DGS Posted January 31, 2005 Posted January 31, 2005 Hi I've created my own toolbar bar control by inheriting the Windows.Forms.Toolbar control to perform some OnPaint() drawing (having set the SetStyle to UserPaint). However when I add the control to a form and programmatically add buttons they appear invisible - although respond to mouse clicks. If I turn off the UserPaint SetStyle they reappear. Does anyone know what I'm missing here? Pointers much appreciated, David. :confused: Quote
donnacha Posted February 1, 2005 Posted February 1, 2005 There is a ".Visible" property on the toolbar buttons, you should set this to visible when you add them programmatically, you probably have the default set to not visible. Quote Hamlet
DGS Posted February 1, 2005 Author Posted February 1, 2005 That was also one of my first thoughts, sadly not so simple. :mad: I suspect that it is something to do with the owner drawing I'm performing is preventing the toolbar from painting the buttons, despite calling the base class paint event. Judging by the low number of replies to this post, everyone simply buys a third party tool? Quote
IngisKahn Posted February 1, 2005 Posted February 1, 2005 My guess is that you need to tell the child controls to draw themselves. Quote "Who is John Galt?"
DGS Posted February 1, 2005 Author Posted February 1, 2005 I feared that. Many thanks for the confirmation, David. Quote
donnacha Posted February 2, 2005 Posted February 2, 2005 why do you need the owner drawn aspect, standard toolbar buttons allow you to have images on them and as I indicated, you will not have the problem you have. Quote Hamlet
DGS Posted February 2, 2005 Author Posted February 2, 2005 I'm not using it as a toolbar. I'm using it as a taskbar, al-la SAS DMS (for those who know what that is) I'm writing an add-in to replicate the DMS in SAS Enterprise Guide. The toolbar control is the nearest control to the taskbar but with a little owner drawing was the perfect thing. :cool: Quote
IcingDeath Posted February 3, 2005 Posted February 3, 2005 Are you calling base class events after you are done painting things? ---- Edit Yep, you are... Quote
IcingDeath Posted February 4, 2005 Posted February 4, 2005 I checked out what you want to do... I overrided ToolBar.OnPaint (or something like that) and tried it out without anything in that sub... nothing bad happened (buttons where visible). The weird thing is that when i typed mybase.onpaint the list that comes out after the dot (.) did not have that method in it but the compiler did not complain about it either (like underlining it or not building the project) Quote
DGS Posted February 4, 2005 Author Posted February 4, 2005 Hmm, something not quite right there then. Quote
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.