C Realization of Winform Method of Setting Window Minimum Size when Drag Window Size with Mouse

  • 2021-08-21 21:10:36
  • OfStack

This article describes the example of C # Winform mouse drag window size when setting the minimum size of the window method. Share it for your reference, as follows:

winform program running process, the user with the mouse to drag the size of the form, such as the form is adjusted to a very small, may form the control on the face of recognition (or can not be seen), with the following code can set the minimum size of the window to prevent this situation


private void Form1_ResizeEnd(object sender, EventArgs e)
{
  //this.Text = "2width:" + this.Width.ToString() + " height:" + this.Height.ToString();
  if (this.Width <= 250) {
    this.Width = 250;
  }
  if (this.Height <= 250)
  {
    this.Height = 250;
  }
}

I hope this article is helpful to everyone's C # programming.


Related articles: