private void PushPinPickerPopup_Paint(object sender, PaintEventArgs e) { int index = startIndex; for (int y = 0; y < 5; y++) { for (int x = 0; x < 8; x++) { if (SelectedIndex == index) { e.Graphics.DrawRectangle(Pens.Yellow, new Rectangle(x * 36, y * 36, 36, 36)); } PushPin.DrawAt(e.Graphics, index, x * 36 + 2, y * 36 + 2); index++; } } }
private void listBox1_DrawItem(object sender, DrawItemEventArgs e) { DomainValue value = (DomainValue)domainList.Items[e.Index]; e.DrawBackground(); e.Graphics.DrawString(value.Text, UiTools.StandardRegular, UiTools.StadardTextBrush, new PointF(e.Bounds.X + 2, e.Bounds.Y + 8)); PushPin.DrawAt(e.Graphics, value.MarkerIndex, e.Bounds.X + 220, e.Bounds.Y + 2); if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { Rectangle rect = e.Bounds; rect.Inflate(-1, -1); e.Graphics.DrawRectangle(Pens.Yellow, rect); } if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) { e.DrawFocusRectangle(); } }