0

for my current project, I need to owner draw the portion of a ComboBox control which is always visible to the user (not the list). My application uses/offers light and dark mode, for which I set the back- and forecolor of each control through their different properties. This works very well, but not for disabled ComboBox controls. When I set FlatStyle to FlatStyle.Flat, I get:

  • dark mode: a white border and arrow area, disabled the border is 2 pixels wide
  • light mode: a white border and lightgrey arrow area, disabled there is a grey border surrounding it

If I don't set the FlatStyle to FlatStyle.Flat, the disabled ComboBox ist completely lightgrey with a grey arrow.

What I need is a grey border (TextBox BorderStyle FixedSingle like), 1px always. Nice to have would be the arrow area in the control's background color and the arrow in the control's text color.

To eventually make it just a bit easier: I only use DropDownStyle = ComboBoxStyle.DropDownList.

Thanks in advance for pointing me in the right direction!

This is what it looks like now

Spider IT
  • 73
  • 1
  • 10
  • Could you explain "owner draw" please? – Fredy Jul 16 '23 at 13:57
  • 1
    https://stackoverflow.com/a/34886006/14171304 ... and you can draw everything yourself with `ComboBoxStyle.DropDownList`. BackColor, button, arrow shape and color... – dr.null Jul 16 '23 at 14:06
  • 1
    See also https://stackoverflow.com/questions/65877575/change-border-color-of-numericupdown for the NUD. – dr.null Jul 16 '23 at 14:11
  • 1
    @Fredy: Owner drawn is when you catch the paint event and do the drawing on the screen yourself. – Spider IT Jul 17 '23 at 07:16
  • 1
    @dr.null: Thanks a lot, that's exactly what I was searching for, but never found it. – Spider IT Jul 17 '23 at 07:17

0 Answers0