0

sorry my english language is bad

I want make a button by another control and this button editable in design mode (change size, define onclick,... )

i create a button in design mode by programming but onclick of this not work in design time

btnTest.Click += new System.EventHandler(this._Click);

protected void _Click(object sender, EventArgs e)
{
    if (DesignMode)
    {
        MessageBox.Show("Hi Design Mode.");
    }
    else
    {
        MessageBox.Show("Hi Run Mode.");
    }
}

don't show show message

Marc
  • 3,905
  • 4
  • 21
  • 37
IM999MaxBonum
  • 171
  • 1
  • 5

1 Answers1

0

for that you need to understand what are you putting in the condition. read here on Control.DesignMode Property:

Gets a value indicating whether a control is being used on a design surface.

The DesignMode property will be set to True when you are editing your winform page in Visual Studio. For example if you create a user control you could show a user control based on dummy data during design-time and at run-time generate a user control based on the provided data

i don't think you can push a button in designer time so this code does nothing i'm afraid

No Idea For Name
  • 11,411
  • 10
  • 42
  • 70