Skip to content

Commit

Permalink
improve default settings for Colors (#13)
Browse files Browse the repository at this point in the history
* set borderdefault for StylableTextBox

* also fix StylableComboBox

* Fix messed up merge code style changes

* Fix colors in ListView

* Updated custom controls to current default values

---------

Co-authored-by: Robin Freund <[email protected]>
  • Loading branch information
wolframhaussig and Nockiro authored Aug 11, 2023
1 parent a80837f commit 6522b29
Show file tree
Hide file tree
Showing 4 changed files with 272 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,16 @@
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ protected override void WndProc(ref Message m)
base.WndProc(ref m);
}

protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
if (this.DropDownStyle != ComboBoxStyle.DropDownList)
{
e.Graphics.DrawRectangle(_borderColorPen, 0, 0, ClientSize.Width - 1, ClientSize.Height - 1);
}
}

private Rectangle GetDownRectangle()
{
return new Rectangle(this.ClientSize.Width - 16, 0, 16, this.ClientSize.Height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace StylableWinFormsControls;

public class StylableListView : ListView
{
private Brush _groupHeaderBackColorBrush = new SolidBrush(Color.Transparent);
private Brush _groupHeaderBackColorBrush = new SolidBrush(Color.LightGray);

/// <summary>
/// Sets the color that build the background of any group header row
Expand All @@ -15,8 +15,8 @@ public Color GroupHeaderBackColor
set => _groupHeaderBackColorBrush = new SolidBrush(value);
}

private Brush _groupHeaderForeColorBrush = new SolidBrush(Color.Orange);
private Pen _groupHeaderForeColorPen = new(Color.Orange);
private Brush _groupHeaderForeColorBrush = new SolidBrush(Color.Black);
private Pen _groupHeaderForeColorPen = new(Color.Black);

/// <summary>
/// Sets the color that build the background of any group header row
Expand All @@ -30,20 +30,20 @@ public Color GroupHeaderForeColor
}
}

private Brush _selectedItemForeColorBrush = new SolidBrush(Color.Orange);
private Brush _selectedItemForeColorBrush = new SolidBrush(Color.Black);

/// <summary>
/// Sets the color that build the background of any group header row
/// Sets the color that build the background of the selected row
/// </summary>
public Color SelectedItemForeColor
{
set => _selectedItemForeColorBrush = new SolidBrush(value);
}

private Brush _selectedItemBackColorBrush = new SolidBrush(Color.Orange);
private Brush _selectedItemBackColorBrush = new SolidBrush(Color.LightGray);

/// <summary>
/// Sets the color that build the background of any group header row
/// Sets the color that build the background of the selected row
/// </summary>
public Color SelectedItemBackColor
{
Expand Down
Loading

0 comments on commit 6522b29

Please sign in to comment.