Esempio n. 1
0
 private void MouseDownHandler(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         label = new MyStatic();
         label.Location = new Point(e.X, e.Y);
     }
 }
Esempio n. 2
0
        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);
        }