Skip to content

Commit

Permalink
Merge pull request #5 from Lokyyn/feature/readme
Browse files Browse the repository at this point in the history
Feature/readme
  • Loading branch information
Lokyyn authored Feb 17, 2024
2 parents ee5ca42 + c931402 commit 9e2d589
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 66 deletions.
58 changes: 3 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,78 +7,26 @@
# Lucid
Lucid is a free WinForms control library with theming, docking and other functionality. This repository builds upon *[DarkUI](https://github.com/RobinPerris/DarkUI)* which is no longer actively maintained. Recognizing this, I decided to enhance it by incorporating my own features that align with my specific requirements. By doing so, I have transformed my private repository into a standalone repository, ready to be shared with the community.

**Feel free to use this in your own projects.**
**Feel free to use this in your own projects and mention it with a link to this repository.**

*NOTE: I will occasionally dedicate time to work on this repository, but please note that new features will be introduced sporadically. If you come across any bugs, I kindly request you to create an issue so that I can address them accordingly.*

# Controls

### ChipControl

This control allows you to create, select and highlight chips. When adding a chip to this control it has a default color which can be adjusted when needed. Furthermore it has two selection modes and different options for adjusting it's visual appearance.

![ChipControl](sample/resources/ChipControl.gif)
~~~
// Adding a chip
lucidChipControl1.Chips.Add(new Controls.Chip() { Text = "Sample Chip", BackColor = Color.BlueViolet });
// Different selection modes
lucidChipControl1.SelectionMode = Lucid.Controls.SelectionMode.Multiple;
lucidChipControl1.SelectionMode = Lucid.Controls.SelectionMode.Single;
// Access chips
var allChips = lucidChipControl1.Chips;
// Check wether the control has chips
var hasChips = lucidChipControl1.HasChips;


// Other look and feel options
lucidChipControl1.SymmetricPadding = 10;
lucidChipControl1.AllowChipSelection = true;
lucidChipControl1.AllowChipDeletion = true;
lucidChipControl1.HighlightChipUnderCursor = true;
lucidChipControl1.ChipsEnabled = true;
~~~

### TreeView

This TreeView has almost all features a normal TreeView has e.g. it has the option to set a node icon when collapsed or expanded. It also features badges which can be used to highlight individual nodes with an information. This badges are fully customizable with its color and text.

![TreeView](sample/resources/TreeView.gif)

Adding a node is pretty straight foward. Just add an node instance to the _Nodes_ collection.
~~~
lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Your first node"));
~~~

In order to add a single or multiple badges to a node lets first declare a variable for this target node.

~~~
var node = new Lucid.Controls.LucidTreeNode("NodeText");
~~~

Now that we can access its instance we can also access a nodes own collection of badges. This two properties are imported for us: _BadgeCollection_ and _BadgeColors_.

Inside the _BadgeCollection_ we only define the text for an badge. You can either directly add an instance to this collection or you just use its overload which accepts three strings.

~~~
node.BadgeCollection.AddBadge("uniqueBadgeId", "This is your Badge Text", "referenceToColorById");
~~~

You noticed that we also need to provide an _ColorId_ for each badge we create. This colors are managed inside the _BadgeColors_ property. Here you have the option to add a color by a direct instance of _System.Drawing.Color_ or by just passing a hex color string to its overload method.

~~~
node.BadgeColors.AddColor("myColorId", Color.Yellow, Color.Black);
node.BadgeColors.AddColor("mySecondColorId", "#5C6BC0", "#000000");
~~~

Thats it! If your _ColorId_ matches any of the given badges it will use this visual options to display the badge. This has the advantage that you can reuse the same color for the same node by just creating one color and linking them with the _ColorId_ from the badge.

**NOTE: Badges as well as Colors are only valid inside the same node and can not be used across nodes**

### FileDrop

![FileDrop](sample/resources/FileDrop.gif)

### Button

### DockPanel
27 changes: 27 additions & 0 deletions sample/getting-started/chipcontrol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### ChipControl

This control allows you to create, select and highlight chips. When adding a chip to this control it has a default color which can be adjusted when needed. Furthermore it has two selection modes and different options for adjusting it's visual appearance.

![ChipControl](sample/resources/ChipControl.gif)
~~~
// Adding a chip
lucidChipControl1.Chips.Add(new Controls.Chip() { Text = "Sample Chip", BackColor = Color.BlueViolet });
// Different selection modes
lucidChipControl1.SelectionMode = Lucid.Controls.SelectionMode.Multiple;
lucidChipControl1.SelectionMode = Lucid.Controls.SelectionMode.Single;
// Access chips
var allChips = lucidChipControl1.Chips;
// Check wether the control has chips
var hasChips = lucidChipControl1.HasChips;
// Other look and feel options
lucidChipControl1.SymmetricPadding = 10;
lucidChipControl1.AllowChipSelection = true;
lucidChipControl1.AllowChipDeletion = true;
lucidChipControl1.HighlightChipUnderCursor = true;
lucidChipControl1.ChipsEnabled = true;
~~~
3 changes: 3 additions & 0 deletions sample/getting-started/filedrop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### FileDrop

![ChipControl](sample/resources/FileDrop.gif)
35 changes: 35 additions & 0 deletions sample/getting-started/treeview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### TreeView

This TreeView has almost all features a normal TreeView has e.g. it has the option to set a node icon when collapsed or expanded. It also features badges which can be used to highlight individual nodes with an information. This badges are fully customizable with its color and text.

![TreeView](sample/resources/TreeView.gif)

Adding a node is pretty straight foward. Just add an node instance to the _Nodes_ collection.
~~~
lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Your first node"));
~~~

In order to add a single or multiple badges to a node lets first declare a variable for this target node.

~~~
var node = new Lucid.Controls.LucidTreeNode("NodeText");
~~~

Now that we can access its instance we can also access a nodes own collection of badges. This two properties are imported for us: _BadgeCollection_ and _BadgeColors_.

Inside the _BadgeCollection_ we only define the text for an badge. You can either directly add an instance to this collection or you just use its overload which accepts three strings.

~~~
node.BadgeCollection.AddBadge("uniqueBadgeId", "This is your Badge Text", "referenceToColorById");
~~~

You noticed that we also need to provide an _ColorId_ for each badge we create. This colors are managed inside the _BadgeColors_ property. Here you have the option to add a color by a direct instance of _System.Drawing.Color_ or by just passing a hex color string to its overload method.

~~~
node.BadgeColors.AddColor("myColorId", Color.Yellow, Color.Black);
node.BadgeColors.AddColor("mySecondColorId", "#5C6BC0", "#000000");
~~~

Thats it! If your _ColorId_ matches any of the given badges it will use this visual options to display the badge. This has the advantage that you can reuse the same color for the same node by just creating one color and linking them with the _ColorId_ from the badge.

**NOTE: Badges as well as Colors are only valid inside the same node and can not be used across nodes**
Binary file added sample/resources/FileDrop.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion source/Lucid.Sample/Pages/MainPage.Designer.cs

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

5 changes: 5 additions & 0 deletions source/Lucid.Sample/Pages/MainPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ private void btRemoveChip_Click(object sender, EventArgs e)
lucidChipControl1.Chips.RemoveAt(r.Next(0, lucidChipControl1.Chips.Count - 1));
lucidChipControl1.Refresh();
}

private void lucidChipControl1_OnChipDeleted(Controls.Chip deletedChip)
{

}
}
2 changes: 1 addition & 1 deletion source/Lucid.Sample/Pages/MainPage.resx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
Expand Down
43 changes: 38 additions & 5 deletions source/Lucid.Sample/SideViews/ToolWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Lucid.Docking;
using Lucid.Theming;

namespace Lucid.Sample.SideViews;

Expand All @@ -9,19 +10,51 @@ public ToolWindow()
InitializeComponent();

lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Node 1"));
lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Node 2"));
lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Node 3"));
lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Node 4"));

var node2 = new Lucid.Controls.LucidTreeNode("Node 2");
var node3 = new Lucid.Controls.LucidTreeNode("Node 3");
var node4 = new Lucid.Controls.LucidTreeNode("Node 4");

node2.ShowProgressBar = true;
node2.ProgressbarSize = Lucid.Controls.DataClasses.BadgeProgressbar.eProgressbarSize.Small;

node2.BadgeCollection.AddBadge("b1", "Badge 1", "c1");
node2.BadgeColors.AddColor("c1", Color.Yellow, Color.Black);

//node3.ShowProgressBar = true;
//node3.ProgressbarSize = Lucid.Controls.DataClasses.BadgeProgressbar.eProgressbarSize.Medium;

node3.BadgeCollection.AddBadge("b1", "Tiny", "c1");
node3.BadgeCollection.AddBadge("b2", "Badge 3 :O", "c2");
node3.BadgeColors.AddColor("c1", Color.Teal, Color.White);
node3.BadgeColors.AddColor("c2", ColorTranslator.FromHtml("#FFA726"), Color.Black);

//node4.ShowProgressBar = true;
//node4.ProgressbarSize = Lucid.Controls.DataClasses.BadgeProgressbar.eProgressbarSize.Large;

node4.BadgeCollection.AddBadge("b1", "Badge with a much longer text", "c1");
node4.BadgeColors.AddColor("c1", ColorTranslator.FromHtml("#5C6BC0"), Color.White);


lucidTreeView.Nodes.Add(node2);
lucidTreeView.Nodes.Add(node3);
lucidTreeView.Nodes.Add(node4);


var node5 = new Lucid.Controls.LucidTreeNode("Node 5");
node5.Nodes.Add(new Lucid.Controls.LucidTreeNode("Child node 1"));
node5.Nodes.Add(new Lucid.Controls.LucidTreeNode("Child node 2"));

var child2 = new Lucid.Controls.LucidTreeNode("Child node 2");
child2.BadgeCollection.AddBadge("b1", "This child badge has much to say", "c1");
child2.BadgeColors.AddColor("c1", ColorTranslator.FromHtml("#43A047"), Color.White);


node5.Nodes.Add(child2);
node5.Nodes.Add(new Lucid.Controls.LucidTreeNode("Child node 3"));
node5.Nodes.Add(new Lucid.Controls.LucidTreeNode("Child node 4"));

lucidTreeView.Nodes.Add(node5);


lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Node 6"));
lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Node 7"));
lucidTreeView.Nodes.Add(new Lucid.Controls.LucidTreeNode("Node 8"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Lucid.Controls.DataClasses.BadgeProgressbar;

public enum eProgressbarSize
{
Small = 10,
Medium = 24,
Large = 32
}
9 changes: 9 additions & 0 deletions source/Lucid/Controls/LucidTreeNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Lucid.Collections;
using Lucid.Controls.DataClasses.Badge;
using Lucid.Controls.DataClasses.BadgeProgressbar;

namespace Lucid.Controls;

Expand Down Expand Up @@ -55,10 +56,18 @@ public string Text

internal Rectangle BadgeArea { get; set; }

internal Rectangle ProgressBarArea { get; set; }

public BadgeCollection BadgeCollection { get; set; }

public BadgeColorCollection BadgeColors { get; set; }

public bool ShowProgressBar { get; set; }

public eProgressbarSize ProgressbarSize { get; set; } = eProgressbarSize.Medium;

public double ProgressBarPercentage { get; set; } = 25;

internal Rectangle FullArea { get; set; }

internal bool ExpandAreaHot { get; set; }
Expand Down
Loading

0 comments on commit 9e2d589

Please sign in to comment.