Invisible Toolbar Buttons

DGS

Newcomer
Joined
Jan 26, 2004
Messages
10
Location
UK
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:
 
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.
 
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?
 
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.
 
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:
 
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)
 
Back
Top