Why not use a label contained within a panel? Ofcourse, panel is to be used
to get the desired back color and a border. I have used a lebel as multiline
command button long back during VB3 days. It worked then and it should work
now also. It has got a click event, so why not? I always wondered, sometimes
annoyed, that a label has got a click event.
I tried to create my own button control, derived from the
Standard button control, and just override the OnPaint
Method and draw the text on the button using a Graphics
object, but it doesn't seem to work, as the button comes
up with no text. What am i doing wrong?
Public Class mButton
Inherits Button
Private g As Graphics
Public Caption As String
Protected Overrides Sub OnPaint(ByVal e As
PaintEventArgs)
g.DrawString(Caption, Font, New SolidBrush
(ForeColor), New RectangleF(0, 0, Width, Height))
End Sub
End Class
-----Original Message-----
Not with the standard Button control. What you can do is create your own
button, derived from Control, since then you will do all painting yourself.
The Custom Controls quickstarts
The problem is that the Button class does not generate a Paint event.
Because you derive from Button you will never receive a Paint event either
so your OnPaint never gets called. You have to derive from Control and do
all drawing yourself. That's where the Picture Button Quickstart sample
might come in handy
(http://samples.gotdotnet.com/quickstart/CompactFramework/)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.