J
jean-dot-paul-at-opelwilly-dot-com
Hello,
I want to swalow all mousclicks in a comboBox control.
I created wy own 'public class roComboBox : System.Windows.Forms.ComboBox '
Created a property ReadOnly and call only the base events if the ReadOnly is
false (see code beneath) but the mousclicks still pass.
Is there such thing as in KeyPress like .Handeled = true ?
Who knows what Im doing wrong ?
Jean Paul
protected override void OnMouseDown(MouseEventArgs e)
{
if (!lokReadOnly)
{
base.OnMouseDown(e);
}
}
protected override void OnMouseUp(MouseEventArgs e)
{
if (!lokReadOnly)
{
base.OnMouseUp (e);
}
}
protected override void OnClick(EventArgs e)
{
if (!lokReadOnly)
{
base.OnClick (e);
}
}
public bool ReadOnly
{
get
{
return lokReadOnly;
}
set
{
lokReadOnly = value;
if (lokReadOnly)
{
this.BackColor = Color.Yellow;
}
else
{
this.BackColor = Color.White;
}
}
}
I want to swalow all mousclicks in a comboBox control.
I created wy own 'public class roComboBox : System.Windows.Forms.ComboBox '
Created a property ReadOnly and call only the base events if the ReadOnly is
false (see code beneath) but the mousclicks still pass.
Is there such thing as in KeyPress like .Handeled = true ?
Who knows what Im doing wrong ?
Jean Paul
protected override void OnMouseDown(MouseEventArgs e)
{
if (!lokReadOnly)
{
base.OnMouseDown(e);
}
}
protected override void OnMouseUp(MouseEventArgs e)
{
if (!lokReadOnly)
{
base.OnMouseUp (e);
}
}
protected override void OnClick(EventArgs e)
{
if (!lokReadOnly)
{
base.OnClick (e);
}
}
public bool ReadOnly
{
get
{
return lokReadOnly;
}
set
{
lokReadOnly = value;
if (lokReadOnly)
{
this.BackColor = Color.Yellow;
}
else
{
this.BackColor = Color.White;
}
}
}