Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UsePreprocessIcon #340

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MaterialSkin/Controls/FlexibleMaterialDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private void InitializeComponent()
this.richTextBoxMessage.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBoxMessage.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.FlexibleMaterialFormBindingSource, "MessageText", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.richTextBoxMessage.Depth = 0;
this.richTextBoxMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.richTextBoxMessage.Font = new System.Drawing.Font("Roboto", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.richTextBoxMessage.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.richTextBoxMessage.Location = new System.Drawing.Point(56, 12);
this.richTextBoxMessage.Margin = new System.Windows.Forms.Padding(0);
Expand Down
44 changes: 42 additions & 2 deletions MaterialSkin/Controls/MaterialDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ public bool UseColors
}
}

[Category("Drawer")]
private bool _usePreprocessIcons;

public bool UsePreProcessIcons
{
get
{
return _usePreprocessIcons;
}
set
{
_usePreprocessIcons = value;
preProcessIcons();
Invalidate();
}
}

[Category("Drawer")]
private bool _highlightWithAccent;

Expand Down Expand Up @@ -214,8 +231,31 @@ private void preProcessIcons()
new float[] { 0, 0, 0, 1, 0}, // alpha scale factor
new float[] { r, g, b, 0, 1}};// offset

ColorMatrix colorMatrixGray = new ColorMatrix(matrixGray);
ColorMatrix colorMatrixColor = new ColorMatrix(matrixColor);

// Create matrices
float[][] matrixStandard = {
new float[] { 1, 0, 0, 0, 0}, // Red scale factor
new float[] { 0, 1, 0, 0, 0}, // Green scale factor
new float[] { 0, 0, 1, 0, 0}, // Blue scale factor
new float[] { 0, 0, 0, 1, 0}, // alpha scale factor
new float[] { 0, 0, 0, 0, 0}};// offset



ColorMatrix colorMatrixGray = new ColorMatrix();
ColorMatrix colorMatrixColor = new ColorMatrix();

if (UsePreProcessIcons)
{
colorMatrixGray = new ColorMatrix(matrixGray);
colorMatrixColor = new ColorMatrix(matrixColor);
}
else
{
colorMatrixGray = new ColorMatrix(matrixStandard);
colorMatrixColor = new ColorMatrix(matrixStandard);
}


ImageAttributes grayImageAttributes = new ImageAttributes();
ImageAttributes colorImageAttributes = new ImageAttributes();
Expand Down
20 changes: 20 additions & 0 deletions MaterialSkin/Controls/MaterialForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ public bool DrawerUseColors
}
}


[Category("Drawer")]
public bool DrawerUsePreprocessIcons
{
get => _drawerUsePreprocessIcons;
set
{
if (_drawerUsePreprocessIcons == value) return;

_drawerUsePreprocessIcons = value;

if (drawerControl == null) return;

drawerControl.UsePreProcessIcons = value;
drawerControl.Refresh();
}
}

[Category("Drawer")]
public bool DrawerHighlightWithAccent
{
Expand Down Expand Up @@ -402,6 +420,7 @@ private bool Maximized
private bool _drawerAutoShow;
private bool _drawerIsOpen;
private bool _drawerUseColors;
private bool _drawerUsePreprocessIcons;
private bool _drawerHighlightWithAccent;
private bool _backgroundWithAccent;
private MaterialDrawer drawerControl = new MaterialDrawer();
Expand All @@ -422,6 +441,7 @@ public MaterialForm()
DrawerIndicatorWidth = 0;
DrawerHighlightWithAccent = true;
DrawerBackgroundWithAccent = false;
DrawerUsePreprocessIcons = true;

FormBorderStyle = FormBorderStyle.None;
Sizable = true;
Expand Down
Binary file added MaterialSkin/Resources/001-data-server.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaterialSkin/Resources/002-cpu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaterialSkin/Resources/003-motherboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaterialSkin/Resources/004-circuit-board.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaterialSkin/Resources/005-server.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaterialSkin/Resources/006-server-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MaterialSkin/Resources/007-oscilloscope.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 34 additions & 12 deletions MaterialSkinExample/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions MaterialSkinExample/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ private void materialSwitch4_CheckedChanged(object sender, EventArgs e)
DrawerUseColors = materialSwitch4.Checked;
}

private void materialSwitch17_CheckedChanged(object sender, EventArgs e)
{
DrawerUsePreprocessIcons = materialSwitch17.Checked;
}

private void MaterialSwitch5_CheckedChanged(object sender, EventArgs e)
{
DrawerHighlightWithAccent = materialSwitch5.Checked;
Expand Down Expand Up @@ -288,7 +293,5 @@ private void materialSwitch16_CheckedChanged(object sender, EventArgs e)
materialTextBox21.ShowAssistiveText = materialSwitch16.Checked;
}



}
}
Loading