Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
- {
- e.DrawBackground();
- int index = e.Index;
- CombinationEntry aFunction = comboBox1.Items[index] as CombinationEntry; //CombinationEntry is a custom object to hold the gray info. Gray if not available and black if available
- if (aFunction.myIsAvailable)
- {
- e.Graphics.DrawString(aFunction.ToString(), new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Pixel), Brushes.Black, new Point(e.Bounds.X, e.Bounds.Y));
- }
- else
- {
- e.Graphics.DrawString(aFunction.ToString(), new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Pixel), Brushes.Gray, new Point(e.Bounds.X, e.Bounds.Y));
- }
- }
- SystemColors.WindowText
- SystemColors.HighlightText
- e.State == DrawItemState.Selected ?
- SystemBrushes.HighlightText : SystemBrushes.WindowText
- SystemBrushes.GrayText
- comboBox1.Font
- if (e.State == ((DrawItemState.NoAccelerator | DrawItemState.NoFocusRect) |
- (DrawItemState.Selected |
- DrawItemState.NoAccelerator |
- DrawItemState.NoFocusRect)))
- {
- e.Graphics.DrawString(aFunction.ToString(),
- new Font("Arial", 10, FontStyle.Regular,
- GraphicsUnit.Pixel),
- SystemBrushes.HighlightText,
- new Point(e.Bounds.X, e.Bounds.Y));
- }
Add Comment
Please, Sign In to add comment