robinperris / darkui Goto Github PK
View Code? Open in Web Editor NEWDark themed control and docking library for .NET WinForms.
License: MIT License
Dark themed control and docking library for .NET WinForms.
License: MIT License
Again, thanks for this great library.
Maybe i missed something, but how can i get the scrollbar in a multiline DarkTextBox displayed in dark mode ?
Thanks,
Michael
Hello, Robin. I have a problem when im trying to add some content on darkdockpanel.
darkDockPanel1.AddContent(new DarkDockContent());
The specified key did not exist in the directory.
This is more a question than a issue, but here i go.
When i add a content using DarkToolWindow, and set the DefaultDockArea to left, i can change the start width of this? If i can, how do i do that?
Is the lua screenshot of syntax highlighting part of the darkui library or is it the editor itself?
If a form has too many combobox, i mean dropdown list then it is using up a lot of resources as compared to other controls like textbox and others
After using the designer to set controls (like DarkSectionPanel) anchor properties that are mostly at the edge of my DarkForm, such as doing Left, Top, Bottom so it's stuck to the left side of the form. Running the app in the normal window state and then maximising doesn't keep the anchoring so that they're stretched across the side of the forms. If you would like to me to include some screenshots to show what I mean. Thanks.
How could I go about compiling this from the command line? I'm interested in providing instructions to my users to clone this repository and build the binary themselves even if they might not have Visual Studio installed. When I try to use dotnet.exe, its throwing errors and I'm not sure why.
Steps to repro from a cmd prompt:
git clone https://github.com/RobinPerris/DarkUI.git
cd darkui
dotnet build
You should see about 24 errors like the following:
C:\Program Files\dotnet\sdk\5.0.102\Microsoft.Common.CurrentVersion.targets(3075,5): error MSB3822: Non-string resources require the System.Resources.Extensions assembly at runtime, but it was not found in this project's references. [C:\Code\DarkUI\DarkUI\DarkUI.csproj]
Of course in Visual Studio 2019, it loads and builds without any issues at all. Maybe I'm missing some switches? Look forward to seeing if this is doable.
Thanks!
When the ComboBox has its DisplayMember property set to access a specific property of the displayed items, ToString() may not give the expected text. The fix for this is to use;
GetItemText(Items[e.Index])
Two methods in class 'DarkComboBox' needs to be updated;
For custom controls, replace hidden properties with a ControlDesigner. I have created an example for you, which can be readily used with the DarkRadioButton
control. This way anything in the "Property Region" that isn't custom can be removed.
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms.Design;
namespace DarkUI.Controls.Design
{
public class DarkUIRadioButtonDesigner : ControlDesigner
{
protected override void PreFilterProperties(IDictionary Properties)
{
List<string> PropList = new List<string>
{
"Appearance",
"AutoEllipsis",
"BackgroundImage",
"BackgroundImageLayout",
"FlatAppearance",
"FlatStyle",
"Image",
"ImageAlign",
"ImageIndex",
"ImageKey",
"ImageList",
"TextAlign",
"TextImageRelation",
"UseCompatibleTextRendering",
"UseVisualStyleBackColor"
};
if (Properties != null)
{
foreach (string Item in PropList)
{
Properties.Remove(Item);
}
}
base.PreFilterProperties(Properties);
}
}
}
Usage:
using DarkUI.Config;
using DarkUI.Controls.Designer;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace DarkUI.Controls
{
[Designer(typeof(DarkUIRadioButtonDesigner))]
public class DarkRadioButton : RadioButton
{
}
Excuse my editing, I can't get the grip on .MD clearly. Thanks.
Woops, I never meant to submit this early.
Basically, how should I go about setting the scrollBar control properties to match those with, e.g. my flowLayoutPanel, so I can imitate its status. I currently have set the Minimum, Maximum and Value properties of the default winform scrollBar, but aren't able to figure out to get the ViewSize. Also, I'm assuming that the ValueChanged event should set the default scrollBar Value property, which works fine, I just cannot get scroll any further than a certain portion of the flowLayoutPanel area.
Thanks.
The DarkComboBox is not drawing correctly if it is in a TableLayoutPanel cell and "Dock" is set to "Fill" and the form is resized. It seems to only draw correctly for the region that represents the original size of the DarkComboBox.
As a work around, when the DarkComboBox is created I set the width to something larger than the form will ever be (such as int.MaxValue) this draws the DarkComboBox correctly even when the form is shrunk. Example workaround code (where "comboControl" is the DarkComboBox):
comboControl.Size = new Size(int.MaxValue, comboControl.Size.Height);
Here is a screenshot of the DarkComboBox before the form is resized:
And here it is after the form is resized:
When I get the package form NuGet, there's a DarkComboBox control. However, this control isn't found in the repository.
With Visual Studio 2022, I get the following error when I try to compile the DarkUI project.
Error CS0234 The type or namespace name 'Icons' does not exist in the namespace 'DarkUI' (are you missing an assembly reference?)
I am not sure if below is the intended way for this event to work, if so please close this isssue.
When using the SelectedNodesChanged event on DarkTreeView an additional event is fired when selecting a node. If the darkTreeView.SelectedNodes.Count is queried when this additional event is fired it returns 0 even though a node is busy being selected. This happens even when MultiSelect is set to True and you select multiple nodes one after another using Ctrl.
I am guessing somewhere in the background every time the tree is clicked it is cleared before being reselected?
My work around for this is to check the selected node count and just return if it is set to 0 as my tree will always have at least 1 node selected.
private void darkTreeView_SelectedNodesChanged(object sender, EventArgs e)
{
if (darkTreeView.SelectedNodes.Count == 0) return;
...
}
Also, EventArgs is always null. Not sure if it should contain information.
I have a DarkDockPanel, and within it there is a split control. When I try to add an additional DarkDockPanel to the split control panel, I get the following exception:
---------------------------
Microsoft Visual Studio
---------------------------
Failed to create component 'DarkDockPanel'. The error message follows:
'System.NullReferenceException: Object reference not set to an instance of an object.
at DarkUI.Docking.DarkDockRegion.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at System.Windows.Forms.Design.ParentControlDesigner.AddChildControl(Control newChild)
at System.Windows.Forms.Design.ParentControlDesigner.AddControl(Control newChild, IDictionary defaultValues)
at System.Windows.Forms.Design.ControlDesigner.InitializeNewComponent(IDictionary defaultValues)
at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)
at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues)
at Microsoft.VisualStudio.Design.Toolbox.AutoToolboxManagerService.ToolboxManagerTool...'
---------------------------
OK
---------------------------
It appears you cannot add a DarkDockPanel to a DarkControl.
When UseMnemonic is set to True, Windows Forms buttons hide the included ampersand (&) and instead underline the character to be used in the Alt + combination. DarkButton with Alt + does work, but it doesn't replace the ampersand with the character underline.
.net 5,.net 6 target not support now
Haven't checked all controls, but the DarkScrollBar and DarkListView don't seem to have OnScroll events.
Do you plan on adding these? Anyway, I added it in a local copy for my app.
As it currently sits the dark list view control has no IndexFromPoint
method, I feel as though it would be a good addition and so I'm kindly asking for it to be implemented. I would do it myself but I am not confident enough with something like that.
Thanks.
Hi Robin,
at first - what a great library. When you don't have lots of money (for DevExpress tools, etc.), your library is really a lifesaver! Now my question... Do you plan (or might have some good advices how) to add the standard dialogs: SaveFileDialog, OpenFileDialog, FolderBrowserDialog, etc.?
Most of the controls which aren't part of DarkUI, but standard Winforms controls can easily by "schemed" by setting Fore and Backcolor to match the look'n'feel of DarkUI. Unfortunately the dialogs, named above, aren't that easy to customize. That's why I'm asking for.
First of all, thank you for creating this neat Dark UI Robin!
I've managed to make my Winforms just how I want it, except...
The scrollbar, see:
I've managed to setup Dark UI using your descriptions, and now it looks like this:
Super sweet!
But.... It's not connected to the listView I'm using there.
How do I link your darkScrollbar to listView?
Or how would I approach this?
Hi,
I would like to know how i can allow DarkDocument tab to be dragged out to a new window and also to be dragged in as a tab back again.
Thank you.
hi, @RobinPerris, thanks for your great work first!
currently i have a question for help.
i added a plotview control on DockDocument. but cannot refresh data on tabbed document(plotview.invalidate() doesn't work) when new date coming in.
could you help me how to refresth new data on plotview?
Thanks!
Is there any way to change the background color of a DarkCheckBox
?
It's automatically set to a fixed gray color, but I'd like to include the checkbox within a striped list, and I can't seem to be able to override that fixed background color. Neither setting the BackColor
property in the Designer nor in a Paint
event worked.
It does work just fine for regular CheckBox
es.
The active control for the radio buttons and check box do not remove their highlight unless you click somewhere or press tab.
other control like tabcontrol
How do I get clicked node text in DarkTreeView
I really appreciate the work done on this library.
I have an issue with the StatusStrip. Regardless of what I do, even on the provided demo, I can't seem to get the StatusStrip to display the sizing grip in the corner. I can see the space padded over when set to visible, but it doesn't display the grip or allow to resize.
Am I missing something?
It would be super awesome if you could migrate to .NET 5. I've forked the repository and got it working fairly easily. Just hoping support from the official nuget package :).
Hello,
I encountered a weird problem, that would indicate a connection between the total amount of items in a DarkListView and the scroll speed of said control.
If I'm using 20 items it takes around 5-6 "scrolls" with the wheel to scroll down by 1 item, however if I'm using 100 items it only takes around 1,5 "scrolls". This behavior doesn't occur in a standard ListView control - the scroll amount is always the same.
It obviously works as intended with more items, but I find it highly frustrating having to scroll 20 times to get down 3 items.
I downloaded the package from NuGet, but also cloned the repository and checked the Example project - the behavior is the same as in my project.
How to restore a saved layout?
Thanks for the cool library, but i'm really mssing a dark DropDown ComboBox.
Any chance to add this ?
Hi, scrollbar of DarkListView in the nuget version of DarkUI doesn't work properly.
It works properly if instead i reference the DarkUI project coming from Github (which doesn't have the DarkComboBox, why?)
Hello, friend
Are there any ideas for adding or other implementations of workarounds for a control?
Thanks you.
Hi,
Thanks a lot for your Dark UI Components library.
I try to use it within a C++ / CLI project in Visual Studio.
I Try to use DockPanel with DockToolWindows
I have created a Form inherited from DarkToolWindow :
public ref class TFrmToolTest : public DarkToolWindow
{
public:
TFrmToolTest(void)
{
this->InitializeComponent();
//
//TODO: ajoutez ici le code du constructeur
//
}
[...]
};
It works fine, In the VS designer, I see my ToolWindow and I can edit it.
My problem :
In my main class (main form), I have created a DarkToolWindow List :
List<DarkToolWindow^>^ ToolWindows;
this->ToolWindows = gcnew List<DarkToolWindow^>();
After that I add a TFrmToolWindow in the list :
this->ToolWindows->Add(gcnew TFrmToolTest());
The runtime error occurs when I try to itterate the list in a for loop to add the ToolWindow to the DarkPanel Components list :
for each (DarkToolWindow ^ toolWindow in this->ToolWindows)
this->DockPanel->AddContent(toolWindow); // <- Runtime error
The error is :
System.Collections.Generic.KeyNotFoundException :
I never had this kind of error before and I can't find a solution.
Do you have an idea of the problem ?
Thanks a lot
Can I add that feature?
Les comentó, estoy intentando hacer una aplicación. Descargué el proyecto DarkUI, pero como no tengo el entorno de desarrollo de Visual Studio 2017 y no tengo intenciones de instalarlo, estoy trabajando con SharpDevelop 5.1
El tema es así, en un momento, logré compilar el proyecto DarkUI.. y utilizar la DLL para agregar controles y demás, pero después, por alguna razón comenzó a arrojar errores, y ahora no me deja agregar controles o me tira errores en el proyecto por muestra errores relacionados a referencia a imágenes incrustadas que dice no encontrarlas o algo así.
Estuve queriendo además, agregar más formularios como el OpenFileDialog o cosas así, pero esto me está quebrando la cabeza, porque ya descargué los Microsoft Build Tools 2013 y 2015 y sigue haciendo lo mismo.
Aclaro, para poder abrir el proyecto DarkUI en SharpDevelop tuve que hacer algunas modificaciones.. pero lo había hecho funcionar.
Ahora no se exactamente qué es lo que está ocurriendo.
No se si es problema del SDK o que..
Necesitaría que alguien me pudiera dar una ayuda..
I tried poking around but I couldn't see how to resolve it.
When adding a ToolStripSplitButton to a DarkToolstrip, the dropdown arrow (on the right) is missing. The dropdown menu appears when you click in the space, but the button icon itself is missing.
The focus events are not rendering the mouse over, either.
Also, thanks for all your work on this project.
scrollbar in panel is not DarkScrollBar,
what can i do ?
When adding an image to a dark button and placing it either before or after text the spacing between the text and image is very large and cannot be adjusted properly. There is a property called ImagePadding whose description says that it adjusts the padding between the image and text, but when changed seems to move the image and text away from the edge of the button while keeping the spacing between the image and button the same.
In light of this, I had a look at the source code and made some changes to the DarkButton to make the button function more like the standard winforms Button, as well as making the ImagePadding property adjust the space between the image and text.
Below are before and after images, as well as the changed code. The code changes were only done to the OnPaint function and all changes occur after the comment:
// =========== CHANGES FROM HERE ONWARDS ============
I don't know if what I have done was the intended way for the button to display (or was the icon always meant to stick to either the left or right edge of the button?). But use the code if it is helpful.
Padding Changes with Current DarkButton. Left button has a padding of 5 and right button has a padding of 20:
DarkButton with Changes as per Code Below:
Padding Changes with DarkButton as per Code Below. Left button has a padding of 5 and right button has a padding of 20:
protected override void OnPaint(PaintEventArgs e)
{
var g = e.Graphics;
var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);
var textColor = Colors.LightText;
var borderColor = Colors.GreySelection;
var fillColor = _isDefault ? Colors.DarkBlueBackground : Colors.LightBackground;
if (Enabled)
{
if (ButtonStyle == DarkButtonStyle.Normal)
{
if (Focused && TabStop)
borderColor = Colors.BlueHighlight;
switch (ButtonState)
{
case DarkControlState.Hover:
fillColor = _isDefault ? Colors.BlueBackground : Colors.LighterBackground;
break;
case DarkControlState.Pressed:
fillColor = _isDefault ? Colors.DarkBackground : Colors.DarkBackground;
break;
}
}
else if (ButtonStyle == DarkButtonStyle.Flat)
{
switch (ButtonState)
{
case DarkControlState.Normal:
fillColor = Colors.GreyBackground;
break;
case DarkControlState.Hover:
fillColor = Colors.MediumBackground;
break;
case DarkControlState.Pressed:
fillColor = Colors.DarkBackground;
break;
}
}
}
else
{
textColor = Colors.DisabledText;
fillColor = Colors.DarkGreySelection;
}
using (var b = new SolidBrush(fillColor))
{
g.FillRectangle(b, rect);
}
if (ButtonStyle == DarkButtonStyle.Normal)
{
using (var p = new Pen(borderColor, 1))
{
var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
g.DrawRectangle(p, modRect);
}
}
// =========== CHANGES FROM HERE ONWARDS ============
var textOffsetX = 0;
var textOffsetXRight = 0;
var textOffsetY = 0;
var horizontalAlignment = StringAlignment.Center;
if (Image != null)
{
var x = (ClientSize.Width / 2) - (Image.Size.Width / 2);
var y = (ClientSize.Height / 2) - (Image.Size.Height / 2);
var stringSize = g.MeasureString(Text, Font, rect.Size);
int extraSpace = 0;
switch (TextImageRelation)
{
case TextImageRelation.ImageAboveText:
textOffsetY = (Image.Size.Height / 2) + (ImagePadding / 2);
y = y - ((int)(stringSize.Height / 2) + (ImagePadding / 2));
break;
case TextImageRelation.TextAboveImage:
textOffsetY = ((Image.Size.Height / 2) + (ImagePadding / 2)) * -1;
y = y + ((int)(stringSize.Height / 2) + (ImagePadding / 2));
break;
case TextImageRelation.ImageBeforeText:
extraSpace = Math.Max(0, rect.Width - ((int)stringSize.Width + Image.Size.Width + Padding.Horizontal + ImagePadding));
textOffsetX = extraSpace / 2 + Image.Size.Width + ImagePadding;
x = Padding.Left + extraSpace / 2;
horizontalAlignment = StringAlignment.Near;
break;
case TextImageRelation.TextBeforeImage:
extraSpace = Math.Max(0, rect.Width - ((int)stringSize.Width + Image.Size.Width + Padding.Horizontal + ImagePadding));
textOffsetXRight = extraSpace / 2 + Image.Width + ImagePadding;
x = rect.Width - (Padding.Right + Image.Width + extraSpace / 2);
horizontalAlignment = StringAlignment.Far;
break;
}
g.DrawImageUnscaled(Image, x, y);
}
using (var b = new SolidBrush(textColor))
{
var modRect = new Rectangle(rect.Left + textOffsetX + Padding.Left,
rect.Top + textOffsetY + Padding.Top,
rect.Width - (Padding.Horizontal + textOffsetX + textOffsetXRight),
rect.Height - Padding.Vertical);
var stringFormat = new StringFormat
{
LineAlignment = StringAlignment.Center,
Alignment = horizontalAlignment,
Trimming = StringTrimming.EllipsisCharacter
};
g.DrawString(Text, Font, b, modRect, stringFormat);
}
}
Hi again!
Good work on your update, everything seems to function perfectly for me. Although, a dark dgv control is missing but is included in the forks I'm using. It's used heavily in my project so will have issues. Is there a chance you'd consider implementing this too?
Thanks.
Hi i have compiled the project and it is really awesome, now i want to try to costumize the title bar and the border for get the best UI.
But i want to ask another thing, i see a tiled editor and a script editor in the screen but they aren't in the project exist a repository where i can found them?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.