public override void OnMouseClick(object o, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: { ItemGridCell cell = o as ItemGridCell; _newcell.ParentGrid = ParentGrid; _newcell.Row = Row; _newcell.Colomn = Colomn; ItemGridDataCell newCell = (ItemGridDataCell)_newcell.Copy(); if (cell == this || cell == null) { ParentGrid.AddCellAt(this.Row, newCell); } else { ParentGrid.InsertCellAt(cell.Colomn, cell.Row, newCell); } newCell.StartEditing(o, e); } break; case MouseButtons.Right: break; } }
//private void row_PropertyChanged(object sender, PropertyChangedEventArgs e) //{ // NotifyRowPropertyChanged(sender); //} private void NotifyRowPropertyChanged(ItemGridCell cell, [CallerMemberName] String propertyName = "") { if (RowChanged != null) { RowChanged(cell.Row, new PropertyChangedEventArgs(propertyName)); } }
/// <summary> /// suposedly resizes the row and column for a given cell to a given cell's size /// this may not be even neciscary or usefull since at the moment the styles are auto. /// </summary> /// <param name="cell"></param> // ReSharper disable once InconsistentNaming public void ResizeXY(ItemGridCell cell) { tableLayoutPanel1.RowStyles[cell.Colomn].Height = cell.Size.Height; tableLayoutPanel1.ColumnStyles[cell.Row].Width = cell.Size.Width; }