Skip to content

Commit

Permalink
Fixed some drawing issues in controls
Browse files Browse the repository at this point in the history
  • Loading branch information
couchcoding committed Jun 30, 2022
1 parent cfb6409 commit 1b88c91
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 44 deletions.
2 changes: 0 additions & 2 deletions src/Couchcoding.Logbert.Gui/Controls/TreeViewEx.cs
Expand Up @@ -163,8 +163,6 @@ public void UseNativeSystemRendering(bool value)
{
CreateHandle();
}

//Win32.SetWindowTheme(Handle, "Explorer", null);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Couchcoding.Logbert.Gui/Properties/AssemblyInfo.cs
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Couchcoding")]
[assembly: AssemblyProduct("Logbert Control Library")]
[assembly: AssemblyCopyright("Copyright © 2021 Couchcoding")]
[assembly: AssemblyCopyright("Copyright © 2022 Couchcoding")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.3.1")]
[assembly: AssemblyFileVersion("1.6.3.1")]
[assembly: AssemblyVersion("1.6.3.2")]
[assembly: AssemblyFileVersion("1.6.3.2")]
6 changes: 3 additions & 3 deletions src/Couchcoding.Logbert.Theme/Properties/AssemblyInfo.cs
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Couchcoding")]
[assembly: AssemblyProduct("Logbert Theme Library")]
[assembly: AssemblyCopyright("Copyright © 2021 Couchcoding")]
[assembly: AssemblyCopyright("Copyright © 2022 Couchcoding")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.3.1")]
[assembly: AssemblyFileVersion("1.6.3.1")]
[assembly: AssemblyVersion("1.6.3.2")]
[assembly: AssemblyFileVersion("1.6.3.2")]
57 changes: 32 additions & 25 deletions src/Logbert/Dialogs/Docking/FrmLogTree.cs
Expand Up @@ -42,7 +42,6 @@
using System.Drawing;

using Couchcoding.Logbert.Logging.Filter;
using Couchcoding.Logbert.Theme.Palettes;
using Couchcoding.Logbert.Theme.Interfaces;
using Couchcoding.Logbert.Theme;
using Couchcoding.Logbert.Theme.Themes;
Expand Down Expand Up @@ -160,7 +159,7 @@ private static void PopulateTreeView(TreeView treeView, string path)

if (lastNode.Parent != null)
{
lastNode.ForeColor = ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForeground;
lastNode.ForeColor = ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForegroundDimmed;
lastNode.Parent.Expand();
}
}
Expand All @@ -178,11 +177,13 @@ private static void PopulateTreeView(TreeView treeView, string path)
treeView.SelectedNode = treeView.Nodes[0];
}

SetNodeColor(treeView.Nodes[0]
, ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForegroundFocused
, false);
//ReColorNodes(treeView.Nodes[0], treeView.SelectedNode, false);

//SetNodeColor(treeView.Nodes[0]
// , ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForeground
// , ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForeground
// , ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForegroundFocused
// , false);
}
}

Expand Down Expand Up @@ -223,6 +224,24 @@ private static void SetNodeColor(TreeNode startNode, Color nodeColor, Color node
}
}

private static void ReColorNodes(TreeNode rootNode, TreeNode node, bool recursive)
{
SetNodeColor(rootNode
, ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForegroundDimmed
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForegroundFocused
, true);

if (node != null)
{
SetNodeColor(node
, ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForegroundFocused
, recursive);
}
}

private void TvLoggerTreeAfterSelect(object sender, TreeViewEventArgs e)
{
if (tvLoggerTree.Nodes.Count == 0)
Expand All @@ -232,20 +251,7 @@ private void TvLoggerTreeAfterSelect(object sender, TreeViewEventArgs e)

try
{
SetNodeColor(tvLoggerTree.Nodes[0]
, ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForegroundDimmed
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForegroundFocused
, true);

if (e.Node != null)
{
SetNodeColor(e.Node
, ThemeManager.CurrentApplicationTheme.ColorPalette.ContentForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForeground
, ThemeManager.CurrentApplicationTheme.ColorPalette.SelectionForegroundFocused
, tsbFilterRecursive.Checked);
}
ReColorNodes(tvLoggerTree.Nodes[0], e.Node, tsbFilterRecursive.Checked);
}
finally
{
Expand Down Expand Up @@ -366,6 +372,10 @@ public void LogMessagesChanged(List<LogMessage> messages, int delta)
finally
{
tvLoggerTree.AfterSelect += TvLoggerTreeAfterSelect;

ReColorNodes(tvLoggerTree.Nodes[0]
, tvLoggerTree.SelectedNode
, tsbFilterRecursive.Checked);
}
}

Expand Down Expand Up @@ -486,15 +496,12 @@ private void DrawPlusMinus(DrawTreeNodeEventArgs e)
return;
}

int indent = (e.Node.Level * tvLoggerTree.Indent) + tvLoggerTree.Margin.Size.Width;
int iconLeft = indent + tvLoggerTree.Indent;

Image img = e.Node.IsExpanded
? ThemeManager.CurrentApplicationTheme.Resources.Images["FrmLogTreeNodeExpanded"]
: ThemeManager.CurrentApplicationTheme.Resources.Images["FrmLogTreeNodeCollapsed"];

e.Graphics.DrawImage(img
, iconLeft - img.Width - 2
, e.Node.Bounds.X - img.Width - 2
, (e.Bounds.Y + (e.Bounds.Height >> 1)) - (img.Height >> 1) - 1);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Logbert/Dialogs/FrmAbout.resx
Expand Up @@ -120,7 +120,7 @@
<data name="txtLicense.Text" xml:space="preserve">
<value>The MIT License (MIT)

Copyright (c) 2021 Couchcoding
Copyright (c) 2022 Couchcoding

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -140,4 +140,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</value>
</data>
</root>
</root>
8 changes: 5 additions & 3 deletions src/Logbert/Dialogs/FrmOptions.cs
Expand Up @@ -95,9 +95,11 @@ private void LstSettingsSelectedIndexChanged(object sender, System.EventArgs e)
{
// Show the new option panel control.
pnlOptionPanel.Controls.Add((Control)lstSettings.SelectedItem);
pnlOptionPanel.AutoScrollMinSize = pnlOptionPanel.Controls[0].MinimumSize;
grpSettings.Text = ((IOptionPanel)lstSettings.SelectedItem).PanelName;
grpSettings.GroupImage = ((IOptionPanel)lstSettings.SelectedItem).Image;

pnlOptionPanel.AutoScrollMinSize = pnlOptionPanel.Controls[0].MinimumSize;
pnlOptionPanel.AutoScrollPosition = new Point(0, 0);
grpSettings.Text = ((IOptionPanel)lstSettings.SelectedItem).PanelName;
grpSettings.GroupImage = ((IOptionPanel)lstSettings.SelectedItem).Image;

// Initialize the new option panel control.
((IOptionPanel)lstSettings.SelectedItem).AdjustSizeAndLocation(grpSettings);
Expand Down
1 change: 1 addition & 0 deletions src/Logbert/Logbert.csproj
Expand Up @@ -573,6 +573,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\FrmAbout.resx">
<DependentUpon>FrmAbout.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\FrmNew.resx">
<DependentUpon>FrmNew.cs</DependentUpon>
Expand Down
6 changes: 3 additions & 3 deletions src/Logbert/Properties/AssemblyInfo.cs
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Couchcoding")]
[assembly: AssemblyProduct("Logbert")]
[assembly: AssemblyCopyright("Copyright © 2021 Couchcoding")]
[assembly: AssemblyCopyright("Copyright © 2022 Couchcoding")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -29,6 +29,6 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.6.3.1")]
[assembly: AssemblyFileVersion("1.6.3.1")]
[assembly: AssemblyVersion("1.6.3.2")]
[assembly: AssemblyFileVersion("1.6.3.2")]
[assembly: NeutralResourcesLanguageAttribute("")]
4 changes: 2 additions & 2 deletions src/Logbert/Properties/Resources.Designer.cs

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

2 changes: 1 addition & 1 deletion src/Logbert/Properties/Resources.resx
Expand Up @@ -125,7 +125,7 @@
<value>..\Resources\action_add_16xMD.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="strAboutDlgCopyright" xml:space="preserve">
<value>Copyright 2021 Couchcoding. All Right Reserved.</value>
<value>Copyright 2022 Couchcoding. All Right Reserved.</value>
</data>
<data name="strColumnizerConfigurationEnterColumnNameAndExpression" xml:space="preserve">
<value>Please enter a name and an expression for each configure column.</value>
Expand Down

0 comments on commit 1b88c91

Please sign in to comment.