public virtual Size GetIdealSize(GraphicsSettings gs) { const int margin = 2; SizeF size = gs.Graphics.MeasureString(DisplayItem.ToString(), Font); return(new Size((int)size.Width + 4, (int)size.Height + margin * 2)); }
private void _list_SelectedIndexChanged(object sender, EventArgs e) { if (_list.SelectedIndex >= 0) { _selectedItem = (DisplayItem)_list.SelectedItem; Text = _selectedItem.ToString(); } else { Text = ""; _selectedItem = null; } OnSelectedItemChanged(); }
public override void Layout(GraphicsSettings gs, Size maximumSize) { const int margin = 2; SizeF size; if (HeaderColumnSection.Column.WrapText) { size = GdiPlusEx.MeasureString(gs.Graphics, DisplayItem.ToString(), Font, maximumSize.Width - 5); } else { size = gs.Graphics.MeasureString(DisplayItem.ToString(), Font); } if (size.Height < MinimumHeight) { size.Height = MinimumHeight; } Size = new Size(maximumSize.Width, (int)size.Height + margin * 2); }