It is possible to have transparency when inheriting from the button class.
As well as setting SupportsTransparentBackColor to true you must set Opaque
to False.
I wrote a button inherited from button a while back and posted the code on
my site.
http://dotnetrix.co.uk/buttons.html
There were a few obstacles to overcome so you may like to just borrow the
code and provide your own paint methods, but as Tim said, Implementing
IButtonControl on your current control should do the trick.
--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Implement the IButtonControl interface in your custom control.
--
Tim Wilson
.Net Compact Framework MVP
"CroDude" <di***********@zg.htnet.hr> wrote in message
news:d9**********@news1.xnet.hr... Hi all!
I've made a button from scratch derived from a Control class. The main
reason why Control and not Button class is used for inheritance is that
when deriving from a control class it's possible to have a transparent
background, while if derived from a button class it isn't.
That's achieved through:
SetStyle(ControlStyles.SupportsTransparentBackColo r, true);
But the problem appears when I place my buttons on a form and try to set
them as a OK/Cancel buttons. It seems that a form can't recognize my
buttons when I want to choose them as OK/Cancel button of a Form.
Is there something that I'm missing? Please help!
Thanks in advance!
Dinko Pavicic