Skip to content

Commit

Permalink
fix wrong font for StylableComboBox (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolframhaussig authored Aug 11, 2023
1 parent 49e805b commit a80837f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ public override Color ForeColor
public StylableComboBox()
{
this.DrawMode = DrawMode.OwnerDrawFixed;
SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
//calling SetStyle before the handle is created will cause erros like wrong fonts
this.HandleCreated += (sender, args) =>
{
SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
};
}

protected override void Dispose(bool disposing)
Expand Down

0 comments on commit a80837f

Please sign in to comment.