Skip to content

Commit

Permalink
Version 3 Release
Browse files Browse the repository at this point in the history
Version 3 of the theme is here!!!
  • Loading branch information
EternalModz committed Apr 11, 2024
1 parent 6b978e9 commit edece09
Show file tree
Hide file tree
Showing 42 changed files with 1,116 additions and 2,834 deletions.
58 changes: 14 additions & 44 deletions CBH-WinForm-Theme-NET/CBH-WinForm-Theme-NET-.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Theme\Controls\Slider\CrEaTiiOn_Slider.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\TabControl\CrEaTiiOn_TabControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Form\CrEaTiiOn_Form.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Theme\Controls\RadioButton\CrEaTiiOn_RadioButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Theme\Controls\Badge\CrEaTiiOn_Badge.cs">
<SubType>Component</SubType>
Expand Down Expand Up @@ -98,7 +110,7 @@
<Compile Include="Theme\Controls\Color Controls\CrEaTiiOn_ColorWheel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Combobox\CrEaTiiOn_ComboBox.cs">
<Compile Include="Theme\Controls\ComboBox\CrEaTiiOn_ComboBox.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Theme\Controls\ControlBox\CrEaTiiOn_ControlBox.cs">
Expand All @@ -119,30 +131,6 @@
<Compile Include="Theme\Controls\GroupBox\CrEaTiiOn_GradientGroupBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\LabelEdit\CrEaTiiOn_LabelEdit.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Label\CrEaTiiOn_AirLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Label\CrEaTiiOn_BigLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Label\CrEaTiiOn_HeaderLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Label\CrEaTiiOn_Label.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Label\CrEaTiiOn_SmallLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\LinkLabelEdit\CrEaTiiOn_LinkLabelEdit.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\LinkLabel\CrEaTiiOn_LinkLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\ListBox\CrEaTiiOn_ListBox.cs">
<SubType>Component</SubType>
</Compile>
Expand Down Expand Up @@ -182,18 +170,6 @@
<Compile Include="Theme\Controls\Progress\CrEaTiiOn_SpinningCircles.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\RadioButton\CrEaTiiOn_AirRadioButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\RadioButton\CrEaTiiOn_ClasicRadioButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\RadioButton\CrEaTiiOn_ModernRadioButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\RadioButton\CrEaTiiOn_RadioButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\RichTextBoxEdit\CrEaTiiOn_RichTextBoxEdit.cs">
<SubType>Component</SubType>
</Compile>
Expand All @@ -212,12 +188,6 @@
<Compile Include="Theme\Controls\Separator\CrEaTiiOn_Separator.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Slider\CrEaTiiOn_FlatSliderBar.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\Slider\CrEaTiiOn_ModernSlider.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Theme\Controls\TabControl\CrEaTiiOn_BarTabControl.cs">
<SubType>Component</SubType>
</Compile>
Expand Down Expand Up @@ -310,7 +280,7 @@
<EmbeddedResource Include="Theme\Controls\Color Controls\CrEaTiiOn_ColorSliderVertical.resx">
<DependentUpon>CrEaTiiOn_ColorSliderVertical.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Theme\Controls\Combobox\CrEaTiiOn_ComboBox.resx">
<EmbeddedResource Include="Theme\Controls\ComboBox\CrEaTiiOn_ComboBox.resx">
<DependentUpon>CrEaTiiOn_ComboBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Theme\Controls\TextBox\CrEaTiiOn_ModernTextBox.resx">
Expand Down
85 changes: 40 additions & 45 deletions CBH-WinForm-Theme-NET/Theme/Controls/Badge/CrEaTiiOn_Badge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,80 +15,71 @@ public class CrEaTiiOnBadge : Control
{
#region Variables

private int _Value = 0;
private int _Maximum = 99;
private Color _BorderColor = Color.FromArgb(250, 36, 38);
private Color _BGColorA = Color.FromArgb(15, 15, 15);
private Color _BGColorB = Color.FromArgb(15, 15, 15);
private int _value = 0;
private int _maximum = 99;
private Color _borderColor = Color.FromArgb(250, 36, 38);
private Color _bgColorA = Color.FromArgb(15, 15, 15);
private Color _bgColorB = Color.FromArgb(15, 15, 15);

#endregion

#region Properties

public int Value
{
get
{
if (_Value == 0)
{
return 0;
}

return _Value;
}
get => _value;
set
{
if (value > _Maximum)
{
value = _Maximum;
}
if (value < 0)
value = 0;
else if (value > _maximum)
value = _maximum;

_Value = value;
_value = value;
Invalidate();
}
}

public int Maximum
{
get => _Maximum;
get => _maximum;
set
{
if (value < _Value)
{
_Value = value;
}
if (value < 0)
value = 0;

_maximum = value;
if (_value > _maximum)
_value = _maximum;

_Maximum = value;
Invalidate();
}
}

public Color BorderColor
{
get => _BorderColor;
set { _BorderColor = value; Invalidate(); }
get => _borderColor;
set { _borderColor = value; Invalidate(); }
}

public Color BGColorA
{
get => _BGColorA;
set { _BGColorA = value; Invalidate(); }
get => _bgColorA;
set { _bgColorA = value; Invalidate(); }
}

public Color BGColorB
{
get => _BGColorB;
set { _BGColorB = value; Invalidate(); }
get => _bgColorB;
set { _bgColorB = value; Invalidate(); }
}

#endregion

public CrEaTiiOnBadge()
{
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
BackColor = Color.Transparent;
DoubleBuffered = true;
ForeColor = Color.White;
Font = new Font("Segoe UI", 8, FontStyle.Bold);
}
Expand All @@ -102,24 +93,28 @@ protected override void OnResize(EventArgs e)
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics _G = e.Graphics;
string myString = _Value.ToString();
_G.SmoothingMode = SmoothingMode.AntiAlias;
LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(Width - 2, Height - 2)), _BGColorA, _BGColorB, 90f);
Graphics g = e.Graphics;
string displayString = _value.ToString();
g.SmoothingMode = SmoothingMode.AntiAlias;
using (LinearGradientBrush lgb = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(Width - 2, Height - 2)), _bgColorA, _bgColorB, 90f))
{
// Fills the body with LGB gradient
g.FillEllipse(lgb, new Rectangle(new Point(1, 1), new Size(Width - 3, Height - 3)));
}

// Fills the body with LGB gradient
_G.FillEllipse(LGB, new Rectangle(new Point(1, 1), new Size(Width - 3, Height - 3)));
// Draw border
_G.DrawEllipse(new Pen(_BorderColor), new Rectangle(new Point(1, 1), new Size(Width - 3, Height - 3)));
_G.DrawString(myString, Font, new SolidBrush(ForeColor), new Rectangle(1, 1, Width - 2, Height - 2), new StringFormat
using (Pen borderPen = new Pen(_borderColor))
{
g.DrawEllipse(borderPen, new Rectangle(new Point(1, 1), new Size(Width - 3, Height - 3)));
}

g.DrawString(displayString, Font, new SolidBrush(ForeColor), new Rectangle(1, 1, Width - 2, Height - 2), new StringFormat
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
});
e.Dispose();
}

}

#endregion
}
}
99 changes: 52 additions & 47 deletions CBH-WinForm-Theme-NET/Theme/Controls/Banner/CrEaTiiOn_Banner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace CBH.Controls
{
public class CrEaTiiOn_Banner : Control
{
private PixelOffsetMode _pixelOffsetType = PixelOffsetMode.HighQuality;
private TextRenderingHint _textRenderingType = TextRenderingHint.ClearTypeGridFit;

public CrEaTiiOn_Banner()
{
Size = new Size(100, 20);
Expand All @@ -19,71 +22,73 @@ public CrEaTiiOn_Banner()
public Color BorderColor { get; set; }
public Color BannerColor { get; set; }

private PixelOffsetMode _pixelOffsetType = PixelOffsetMode.HighQuality;
public PixelOffsetMode PixelOffsetType
{
get => _pixelOffsetType;
set
{
_pixelOffsetType = value;
Invalidate();
}
set { _pixelOffsetType = value; Invalidate(); }
}

private TextRenderingHint _textRenderingType = TextRenderingHint.ClearTypeGridFit;
public TextRenderingHint TextRenderingType
{
get => _textRenderingType;
set
{
_textRenderingType = value;
Invalidate();
}
set { _textRenderingType = value; Invalidate(); }
}

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);

// Draw the banner
DrawBanner(e.Graphics);
DrawText(e.Graphics);
}

private void DrawBanner(Graphics graphics)
{
var list = new[]
{
new Point(0, Height / 10 * 5),
new Point(Height / 10, Height / 10 * 4),
new Point(Height / 10 * 2, Height / 10 * 3),
new Point(Height / 10 * 3, Height / 10 * 2),
new Point(Height / 10 * 4, Height / 10),
new Point(Height / 10 * 5, 0),
new Point(Width - Height / 10 * 5, 0),
new Point(Width - Height / 10 * 4, Height / 10),
new Point(Width - Height / 10 * 3, Height / 10 * 2),
new Point(Width - Height / 10 * 2, Height / 10 * 3),
new Point(Width - Height / 10, Height / 10 * 4),
new Point(Width, Height / 10 * 5),
new Point(Width - Height / 10, Height / 10 * 6),
new Point(Width - Height / 10 * 2, Height / 10 * 7),
new Point(Width - Height / 10 * 3, Height / 10 * 8),
new Point(Width - Height / 10 * 4, Height / 10 * 9),
new Point(Width - Height / 10 * 5, Height / 10 * 10),
new Point(Height / 10 * 5, Height / 10 * 10),
new Point(Height / 10 * 4, Height / 10 * 9),
new Point(Height / 10 * 3, Height / 10 * 8),
new Point(Height / 10 * 2, Height / 10 * 7),
new Point(Height / 10, Height / 10 * 6),
new Point(0, Height / 10 * 5)
};
var brush = new SolidBrush(BannerColor);
e.Graphics.FillPolygon(brush, list);
new Point(0, Height / 10 * 5),
new Point(Height / 10, Height / 10 * 4),
new Point(Height / 10 * 2, Height / 10 * 3),
new Point(Height / 10 * 3, Height / 10 * 2),
new Point(Height / 10 * 4, Height / 10),
new Point(Height / 10 * 5, 0),
new Point(Width - Height / 10 * 5, 0),
new Point(Width - Height / 10 * 4, Height / 10),
new Point(Width - Height / 10 * 3, Height / 10 * 2),
new Point(Width - Height / 10 * 2, Height / 10 * 3),
new Point(Width - Height / 10, Height / 10 * 4),
new Point(Width, Height / 10 * 5),
new Point(Width - Height / 10, Height / 10 * 6),
new Point(Width - Height / 10 * 2, Height / 10 * 7),
new Point(Width - Height / 10 * 3, Height / 10 * 8),
new Point(Width - Height / 10 * 4, Height / 10 * 9),
new Point(Width - Height / 10 * 5, Height / 10 * 10),
new Point(Height / 10 * 5, Height / 10 * 10),
new Point(Height / 10 * 4, Height / 10 * 9),
new Point(Height / 10 * 3, Height / 10 * 8),
new Point(Height / 10 * 2, Height / 10 * 7),
new Point(Height / 10, Height / 10 * 6),
new Point(0, Height / 10 * 5)
};
using (var brush = new SolidBrush(BannerColor))
{
graphics.FillPolygon(brush, list);
}
}

// Draw the text
var font = new Font(FontFamily.GenericSansSerif, Height / 4);
var stringFormat = new StringFormat()
private void DrawText(Graphics graphics)
{
using (var font = new Font(FontFamily.GenericSansSerif, Height / 4))
using (var brush = new SolidBrush(ForeColor))
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
};
brush = new SolidBrush(ForeColor);
e.Graphics.DrawString(Text, font, brush, ClientRectangle, stringFormat);
var stringFormat = new StringFormat()
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center
};
graphics.TextRenderingHint = TextRenderingType;
graphics.DrawString(Text, font, brush, ClientRectangle, stringFormat);
}
}
}
}
Loading

0 comments on commit edece09

Please sign in to comment.