//用于DockPanel生成DockForm public void createDockForm(DockForm df, DockPanel dp, Point point) { df.Title = dp.DockPanelTitle; df.StartPosition = FormStartPosition.Manual; df.Location = point; df.Size = dp.Size; df.viewPanels.Controls.Add(dp.tempPanel); df.Show(); }
private void panel1_MouseMove(object sender, MouseEventArgs e) { if (isDown) { point = new Point(Cursor.Position.X - startPoint.X, Cursor.Position.Y - startPoint.Y); if (unlock) { this.Visible = false; dd = new DockForm(dpForm, this.Dock); dpForm.createDockForm(dd, this, point); unlock = false; } else { dd.Left = point.X; dd.Top = point.Y; } } }
private void Tab_MouseMove(object sender, MouseEventArgs e) { if (TabIsDown) { if (e.X - startPoint.X > 5) { if (this.TabBox.Controls.Count == 1) { MessageBox.Show("您要留一个呀", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (unlack) { df = new DockForm(m_form); point = new Point(Cursor.Position.X - startPoint.X, Cursor.Position.Y - startPoint.Y); df.Title = this_tab.TabTitle; df.viewPanels.Controls.Add(this_tab.TabPanel); df.Size = this.Size; df.StartPosition = FormStartPosition.Manual; df.Location = point; this.DelTab(this_tab); df.Show(); //為當前的應用程序釋放鼠標鋪獲 ReleaseCapture(); //發送消息﹐讓系統誤以為在标题栏上按下鼠標 SendMessage((int)df.Handle, 0x0112, 0xf012, 0); unlack = false; } else { df.Location = new Point(point.X, point.Y); } } } } }
//用于DockForm生成DockPanel public void createDockPanel(DockForm df, DockStyle ds) { df.Show(this, ds, df.viewPanels); }