I'm trying to create a DevExpress ComboBoxEdit with a linear gradient painted background, but the control itself doesn't support it directly (see: http://www.devexpress.com/Support/Center/p/Q233062.aspx
I'd basically want to override OnPaint, in it manually draw the gradient background and then let the default drawing draw everything ELSE, but I can't seem to get this to happen.
Below is my current attempt at creating an overriden version of the ComboBoxEdit. There I basically try to do the background, then set the backgound color to transparent and call the base OnPaint so that it would not paint the background (since it is transparent) but paint everything else.
public class ComboBoxEditWithGradient : ComboBoxEdit
protected override void OnPaint(PaintEventArgs e)
kColor2 != Properties.Appearance.Back
LinearGradientBrush gradientBrush = new LinearGradientBrush(new Point(0, 0),
new Point(ClientSize.Width, 0),
Color oldColor = Properties.Appearance.Back
Color = Color.Transparent;
Color = oldColor;
This seems like it could produce the desired result, BUT it really jams the GUI execution, i.e. the OnPaint events just keep firing, so clearly there's something wrong in here. I also tried with putting a boolean flag ignoreEvents to true when within the OnPaint and exiting it if coming to the method and that is on, but that didn't affect, so it doesn't seem to come directly recursively to itself at least.
If I leave out the setting of the properties and the calling of the base.OnPaint, then I just get the gradient rectangle and nothing else, as could be expected (and no jamming). If I just call the base.OnPaint without changing the properties, then I don't get the jamming problem, but the base-painting covers up the gradient background.
Sorry if I'm asking the obvious, but if anyone can point me to a (preferably simple) solution for creating a ComboBoxEdit with linear gradient, I'd greatly appreciate it!