I got a user control called PicturePanel. On the mouse events (MouseDown, MouseMove, MouseUp), I have the following:
protected override void OnMouseDown(MouseEventArgs e)
{
if (marquee == true && e.Button == MouseButtons.Left && BackgroundImage != null)
{
//Code to create rectangular marquee
}
else
{
}
}
Class level variable private bool marquee = false by default. And a public one.
private bool marquee = false;
public bool Marquee
{
get { return marquee; }
set { marquee = value; }
}
I even tried assigning the false at initialization:
public PicturePanel()
{
InitializeComponent();
marquee = false;
}
But marquee is always true by default. If I want to turn off marquee, I have to set it through the public variable picturePanel1.Marquee = false in the form. How can I make marquee false by default within the user control?
I’m not sure if this is what you’re talking about, but if you’re referring to the default value that you see in the designer, then you just need to add the following attribute to your property: