private void btnProjectView_Click(object sender, EventArgs e) { bool activeForm = false; foreach (TabControlPanelItem tabControlPanelItem in mainForm.TabControlPanel.Controls) { if (tabControlPanelItem.TabButton.Text == Project.Title) { tabControlPanelItem.TabButton.HideForms(); tabControlPanelItem.BorderStyle = BorderStyle.Fixed3D; tabControlPanelItem.Form.Show(); tabControlPanelItem.Form.Location = new Point(0, 0); activeForm = true; break; } } if (!activeForm) { ProjectView projectView = new ProjectView(); projectView.Project = this.Project; TabControlPanelItem tabControlPanelItem = new TabControlPanelItem(Project.Title); tabControlPanelItem.Form = projectView; mainForm.TabControlPanel.Controls.Add(tabControlPanelItem); mainForm.TabControlPanel.Controls.SetChildIndex(tabControlPanelItem, 0); projectView.MdiParent = mainForm; projectView.Show(); } }
private void btnTaskDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Task'ı silmek istediğinizden emin misiniz ?", "QUESTİON", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { workFollow.AllWorkFollowDelete(task.ID); task.Delete(); MainForm mainForm = Application.OpenForms["MainForm"] as MainForm; foreach (Form Form in mainForm.MdiChildren) { if (Form.Name == "ProjectView") { ProjectView projectView = Form as ProjectView; foreach (EventTab eventTab in projectView.Project.eventTabs) { if (eventTab.ID == task.EventTabID) { eventTab.Controls.Remove(task.TaskButton); this.Close(); } } } } foreach (TabControlPanelItem item in mainForm.TabControlPanel.Controls) { if (item.Form == this) { item.CloseButton.close(); } } } }
private void TaskButton_MouseMove(object sender, MouseEventArgs e) { ProjectView projectView = this.Parent.Parent as ProjectView; if (isMouseDown) { if (Math.Abs(mouseDownX - e.X) > 10 || Math.Abs(mouseDownY - e.Y) > 10) { Button selectedButton = (Button)sender; selectedButton.DoDragDrop(selectedButton, DragDropEffects.All); isMouseDown = false; } } }