private void dlis_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); if (e.Index >= 0) { DLIListEntry DLIListEntry = ((DLIListEntry)dlis.Items[e.Index]); e.Graphics.DrawString(DLIListEntry.ToString(), e.Font, Brushes.Black, e.Bounds, StringFormat.GenericDefault); Rectangle rect = e.Bounds; rect.Height -= 3; rect.X += 45; rect.Y += 1; rect.Width = 18; AtariPFColors DliColors = DLIListEntry.dli.AtariPFColors; byte[] colorValues = { DliColors.Colbk, DliColors.Colpf3, DliColors.Colpf2, DliColors.Colpf1, DliColors.Colpf0 }; foreach (byte colorValue in colorValues) { using (Brush brush = new SolidBrush(palette.GetColorFromAtariColorValue(colorValue))) { e.Graphics.FillRectangle(brush, rect); e.Graphics.DrawRectangle(Pens.Black, rect); rect.X += rect.Width + 2; } } } }
private void toolStripComboBoxColors_SelectedIndexChanged(object sender, EventArgs e) { DLIListEntry dLIListEntry = (DLIListEntry)toolStripComboBoxColors.SelectedItem; AtariPFColors = dLIListEntry.dli.AtariPFColors; OnDLISelected?.Invoke(this, new DLISelectedEventArgs(dLIListEntry.dli)); }