/// <summary> /// 鼠标弹起事件:让自定义的边框出现 /// </summary> void MouseUp(object sender, MouseEventArgs e) { if (!_isOpenDrag) { return; } Control ct = sender as Control; ct.Refresh(); if (_fc != null) { _fc.Visible = true; _fc.Draw(); DragControlInfo dci = null; if (ct.Tag == null) { dci = new DragControlInfo(); dci.Name = ct.Name; dci.ParentName = ct.Parent.Name; } else { dci = ct.Tag as DragControlInfo; } dci.Location = ct.Location; dci.Size = ct.Size; ct.Tag = dci; } }
/// <summary> /// 鼠标单击事件:用来显示边框 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void MouseClick(object sender, MouseEventArgs e) { if (!_isOpenDrag) { return; } Control ct = sender as Control; if (ct is TabPage) { return; } ct.Parent.Refresh(); ct.BringToFront(); _fc = new FrameControl(ct); ct.Parent.Controls.Add(_fc); _fc.Visible = true; _fc.Draw(); }
/// <summary> /// 鼠标单击事件:用来显示边框 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MouseClick(object sender, MouseEventArgs e) { if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { System.Diagnostics.Debug.WriteLine("Press Ctrl"); } else { this.CancelSelectedControlEvent(this._currentControl); this._currentControl.Parent.Refresh(); } this.SelectedControlEvent(this._currentControl); this._currentControl.BringToFront(); var _fc = new FrameControl(this._currentControl); this._currentControl.Parent.Controls.Add(_fc); _fc.Visible = true; _fc.Draw(); }