Cor,
A picture box does not have a click event.
Is a false statement!
PictureBox inherits from Control, Control has a Click event, ergo PictureBox
has a click event!
Add a PictureBox control to your favorite form, name it PictureBox1, add the
following code:
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox1.Click
MessageBox.Show("PictureBox1_Click", Application.ProductName)
End Sub
Run the form, click the PictureBox, what do you see?
A label has as well a click as well. But no things as Button.performclick
To enable "PerformClick", you would need to inherit from PictureBox (or
Label) & implement the IButtonControl, something like:
Public Class PictureBoxEx
Inherits PictureBox
Implements IButtonControl
Private m_dialogResult As DialogResult
Public Property DialogResult() As DialogResult Implements
IButtonControl.DialogResult
Get
Return m_dialogResult
End Get
Set(ByVal value As DialogResult)
m_dialogResult = value
End Set
End Property
Public Sub NotifyDefault(ByVal value As Boolean) Implements
IButtonControl.NotifyDefault
' TODO: Handle the notification!
' Notifies a control that it is the default button
' so that its appearance and behavior is adjusted accordingly.
End Sub
Public Sub PerformClick() Implements IButtonControl.PerformClick
MyBase.OnClick(EventArgs.Empty)
End Sub
End Class
By implementing IButtonControl, a PictureBoxEx can be used as either
Form.AcceptButton or Form.CancelButton!
You can use ControlPaint.DrawBorder or roll your own "shadowing" & border
effects...
Something like:
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
ControlPaint.DrawBorder3D(e.Graphics, Me.ClientRectangle)
End Sub
Hope this helps
Jay