/////// private void DataGridViewKai_MouseDown(object sender, MouseEventArgs e) { /////// rowstomove.Clear(); rowstodel.Clear(); Int32 selectedRowCount = this.Rows.GetRowCount(DataGridViewElementStates.Selected); for (int i = 0; i < selectedRowCount; i++) { rowstomove.Add((DataGridViewRow)this.SelectedRows[i].Clone()); rowstodel.Add(this.SelectedRows[i].Index); } /////// if ((e.Button & MouseButtons.Left) == MouseButtons.Left) // SOR ADAT MOZGATÁSA BAL KLIKKEL { dgwk = this; // Get the index of the item the mouse is below. rowIndexFromMouseDown = this.HitTest(e.X, e.Y).RowIndex; if (rowIndexFromMouseDown != -1) { // Remember the point where the mouse down occurred. The DragSize indicates the size that the mouse can move before a drag event should be started. Size dragSize = SystemInformation.DragSize; // Create a rectangle using the DragSize, with the mouse position being at the center of the rectangle. dragBoxFromMouseDown = new Rectangle(new Point(e.X - (dragSize.Width / 2), e.Y - (dragSize.Height / 2)), dragSize); } else // Reset the rectangle if the mouse is not over an item in the ListBox. { dragBoxFromMouseDown = Rectangle.Empty; } } }
public DataGridViewSystemContainer(DataGridViewKai dgvk, Dgv_Exp_Horizontal dgv_e_h, Dgv_Exp_Vertical dgv_e_v, Dgv_Exp_Combined dgv_e_c, Dgv_Mover dgv_m) { Dgvk = dgvk; Dgv_e_h = dgv_e_h; Dgv_e_v = dgv_e_v; Dgv_e_c = dgv_e_c; Dgv_m = dgv_m; }
private void button1_Click(object sender, EventArgs e) // TODO ÁTVINNI FILEDATA-BA { //fdr.Fut(); //Thread t = new Thread(); for (int i = 0, j = 0; i < 9; i++) { if (i % 2 == 0 && i != 0) { j += 2; } DataGridViewKai dgvk1 = new DataGridViewKai(); dgvk1.Size = new Size(950, 150); //dgvk1.Location = new Point(50, 100); dgvk1.Location = new Point(((i % 2) * 1000) + 50, (j * 150) + 50); //dgvk1.Columns.Add("asd", "asd"); //dgvk1.Columns.Add("lol", "lol"); //dgvk1.Columns.Add("kek", "kek"); //dgvk1.Columns.Add("bur", "bur"); //dgvk1.Columns.Add("baz", "baz"); dgvk1.Columns.Add("nev", "név"); dgvk1.Columns.Add("neptun", "Neptun"); dgvk1.Columns.Add("irsz", "Irsz."); dgvk1.Columns.Add("nem", "Nem"); dgvk1.Columns.Add("kartya", "Kártya"); dgvk1.Columns.Add("szoba", "Szoba"); dgvk1.Columns.Add("emelet", "Emelet"); dgvk1.Columns.Add("garda", "Gárda"); dgvk1.Columns.Add("szin", "Szín"); // 9 rows total dgvk1.Rows.Add("asd", "lol", "kek", "bur", "baz", "baz2", "baz3", "baz4", "baz5"); dgvk1.AllowUserToAddRows = true; panel1.Controls.Add(dgvk1); Dgv_Exp_Horizontal dgv_e_h = new Dgv_Exp_Horizontal(dgvk1); dgv_e_h.Cursor = Cursors.SizeWE; dgv_e_h.Width = 10; dgv_e_h.Height = dgvk1.Height; //dgv_e_h.Location = new Point(250, 100); dgv_e_h.Location = new Point(dgvk1.Left + dgvk1.Width, dgvk1.Top); panel1.Controls.Add(dgv_e_h); Dgv_Exp_Vertical dgv_e_v = new Dgv_Exp_Vertical(dgvk1); dgv_e_v.Cursor = Cursors.SizeNS; dgv_e_v.Width = dgvk1.Width; dgv_e_v.Height = 10; //dgv_e_v.Location = new Point(50, 200); dgv_e_v.Location = new Point(dgvk1.Left, dgvk1.Top + dgvk1.Height); panel1.Controls.Add(dgv_e_v); Dgv_Mover dgv_m = new Dgv_Mover(dgvk1); dgv_m.Cursor = Cursors.SizeAll; //dgv_m.Location = new Point(40, 90); dgv_m.Location = new Point(dgvk1.Left - 10, dgvk1.Top - 10); panel1.Controls.Add(dgv_m); Dgv_Exp_Combined dgv_e_c = new Dgv_Exp_Combined(dgvk1); dgv_e_c.Cursor = Cursors.SizeAll; //dgv_e_c.Location = new Point(250, 200); dgv_e_c.Location = new Point(dgvk1.Left + dgvk1.Width, dgvk1.Top + dgvk1.Height); panel1.Controls.Add(dgv_e_c); dgv_e_h.Dgv = dgvk1; dgv_e_h.Dgv_e_v = dgv_e_v; dgv_e_h.Dgv_e_c = dgv_e_c; dgv_e_h.Dgv_m = dgv_m; dgv_e_v.Dgv = dgvk1; dgv_e_v.Dgv_e_h = dgv_e_h; dgv_e_v.Dgv_e_c = dgv_e_c; dgv_e_v.Dgv_m = dgv_m; dgv_e_c.Dgv = dgvk1; dgv_e_c.Dgv_e_h = dgv_e_h; dgv_e_c.Dgv_e_v = dgv_e_v; dgv_e_c.Dgv_m = dgv_m; dgv_m.Dgv = dgvk1; dgv_m.Dgv_e_h = dgv_e_h; dgv_m.Dgv_e_v = dgv_e_v; dgv_m.Dgv_e_c = dgv_e_c; //l.Add(new DataGridViewSystemContainer(dgvk1, dgv_e_h, dgv_e_v, dgv_e_c, dgv_m)); } }