예제 #1
0
파일: Form1.cs 프로젝트: Geiko/WinForms
 private void MouseDownHandler(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         label = new MyStatic();
         label.Location = new Point(e.X, e.Y);
     }
 }
예제 #2
0
파일: Form1.cs 프로젝트: Geiko/WinForms
        public void SetRect(out MyStatic rect, MouseEventArgs e)
        {
            int left;
            if (this.label.Location.X < e.X)
                left = this.label.Location.X;
            else left = e.X;
            int upper;
            if (this.label.Location.Y < e.Y)
                upper = this.label.Location.Y;
            else upper = e.Y;

            int width = Math.Abs(e.X - this.label.Location.X);
            int height = Math.Abs(e.Y - this.label.Location.Y);

            rect = new MyStatic();
            rect.Location = new Point(left, upper);
            rect.Size = new Size(width, height);
        }