protected virtual ReminderListBox CreateListBox() { ReminderListBox listBox = new ReminderListBox(this); listBox.DataSource = Notes; listBox.DrawMode = DrawMode.OwnerDrawVariable; listBox.Parent = this; return(listBox); }
internal void CalcViewInfo() { using (Graphics graphics = CreateGraphics()) { ViewInfo.CalcViewInfo(graphics); ReminderListBox.Bounds = ViewInfo.ItemsRectangle; ReminderListBox.CalcButton(graphics); EditPanel.Bounds = ViewInfo.ItemsRectangle; } MinimumSize = new Size(ViewInfo.HeaderTextBounds.Width + HeaderButton.ButtonViewInfo.Bounds.Width, 0); ReminderListBox.Invalidate(); }
private void InvalidateButtons(ButtonViewInfo buttonViewInfo) { if (buttonViewInfo.Owner.Kind == ButtonKind.HeaderAdd) { Invalidate(ViewInfo.HeaderBounds); } else { int index = ReminderListBox.ButtonsInfo.IndexOf(buttonViewInfo); if (index == -1) { return; } Rectangle itemRect = ReminderListBox.GetItemRectangle(index); ReminderListBox.Invalidate(itemRect); } }
protected virtual void DrawNoteButton(DrawItemEventArgs e, ReminderControl reminderControl) { Button noteButton = reminderControl.NoteButton; ReminderListBox listBox = reminderControl.ReminderListBox; if (e.Index < listBox.ButtonsInfo.Count) { ButtonViewInfo buttonViewInfo = listBox.ButtonsInfo[e.Index]; Rectangle buttonRect = buttonViewInfo.Bounds; Rectangle textRect = buttonViewInfo.TextBounds; buttonViewInfo.OffsetBounds(e.Bounds.Location, buttonViewInfo, buttonRect, textRect); noteButton.ButtonPainter.Draw(e.Graphics, buttonViewInfo); buttonViewInfo.RestoreBounds(e.Bounds.Location, buttonViewInfo, buttonRect, textRect); } }
public virtual void DrawItem(DrawItemEventArgs e, ReminderControl reminderControl) { ReminderListBox listBox = reminderControl.ReminderListBox; Note note = listBox.Items[e.Index] as Note; e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.Bounds); e.Graphics.DrawRectangle(Pens.Indigo, e.Bounds); Rectangle noteRect = GetNoteTextRect(e, note, listBox.Font); e.Graphics.DrawString(note.Text, listBox.Font, Brushes.White, noteRect); string description = listBox.GetDescription(note); Rectangle descriptionRect = GetDescriptionRect(e, noteRect, description, listBox.DescriptionFont); e.Graphics.DrawString(description, listBox.DescriptionFont, Brushes.DarkOrange, descriptionRect); DrawNoteButton(e, reminderControl); if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { e.Graphics.DrawRectangle(Pens.White, e.Bounds); } }