예제 #1
0
 private void Control_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         selectmode = true;
         downpoint  = e.Location;
         int   size           = 8;//获得边框矩形大小
         Point selectLocation = new Point(((Control)sender).Location.X - size, ((Control)sender).Location.Y - size);
         this.PB_background.Controls.SetChildIndex((Control)sender, 0);
         if (selectbox == null)
         {
             selectbox          = new SelectControl(((Control)sender).Width + 2 * size, ((Control)sender).Height + 2 * size);
             selectbox.Location = selectLocation;
             this.PB_background.Controls.Add(selectbox);
         }
         else
         {
             if (selectbox.Location != selectLocation)
             {
                 this.PB_background.Controls.Remove(selectbox);
                 selectbox.Dispose();
                 selectbox          = new SelectControl(((Control)sender).Width + 2 * size, ((Control)sender).Height + 2 * size);
                 selectbox.Location = selectLocation;
                 this.PB_background.Controls.Add(selectbox);
                 this.PB_background.Controls.SetChildIndex(selectbox, 1);
             }
         }
         this.PB_background.Refresh();
     }
 }
예제 #2
0
 private void Sender_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete && selectmode == true)
     {
         PB_background.Controls.RemoveAt(0);
         PB_background.Controls.Remove(selectbox);
         selectbox.Dispose();
         selectbox  = null;
         selectmode = false;
     }
 }
예제 #3
0
 /// <summary>
 /// 放大A4纸
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void 放大ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (selectbox != null)
     {
         PB_background.Controls.Remove(selectbox);
         selectbox.Dispose();
         selectbox = null;
     }
     selectmode = false;
     boxscale   = boxscale * 1.2;
     ResizeAllControl();
     //todo
 }
예제 #4
0
 /// <summary>
 /// 鼠标弹起事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Background_MouseUp(object sender, MouseEventArgs e)
 {
     if (selectmode == true)
     {
         if (selectbox != null)
         {
             PB_background.Controls.Remove(selectbox);
             selectbox.Dispose();
             selectbox = null;
         }
         selectmode = false;
     }
 }