编程语言
首页 > 编程语言> > c# winform 不得不爱,(控件窗口尺寸)

c# winform 不得不爱,(控件窗口尺寸)

作者:互联网

 

  private void button2_MouseEnter(object sender, EventArgs e) //mouseENter方法,鼠标进入图形部分时
        {
            //根据客户端尺寸变更长短
            int x = this.ClientSize.Width - button2.ClientSize.Width;
            int y = this.ClientSize.Height - button2.ClientSize.Height;
            //随机数 next()
            Random rom = new Random();
            //point为结构
            button2.Location = new Point(rom.Next(0,x),rom.Next(0,y));
        }

  

 

标签:控件,rom,Width,c#,Next,button2,int,ClientSize,winform
来源: https://www.cnblogs.com/yaoyue68/p/14629996.html