Code Monkey home page Code Monkey logo

darkui's Introduction

DarkUI

Dark themed control and docking library for .NET WinForms.

About DarkUI

DarkUI is an attempt to create a simple, extensible control library which emulates the look and feel of popular tabbed document interfaces such as Visual Studio, Photoshop, WebStorm, and XCode. Originally just a collection of bug fixes and enhancements built on top of WinForms, it has now evolved in to a fully working docking and control library.

Check out our GitHub pages site.

Attribution

Special thanks to the team over at Ascension Game Dev for expanding the library to include DarkComboBox, DarkGroupBox, and DarkNumericUpDown.

How to use

The best way to learn how to use DarkUI is to check out the Example project included with the source code. It'll show you how to use the majority of the forms, controls, and docking components.

You can also read the GitHub project wiki. This contains all the information you need to get started as well as more detailed information and guides.

Screenshots

Game map editor

Game map editor

Lua script editor

Lua script editor

Example docking application

Example docking application

Controls preview

Controls preview

darkui's People

Contributors

janrobas avatar jdunlap avatar robinperris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

darkui's Issues

DarkTextBox => White Scrollbar

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

A suggestion for property cleanup

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.

DarkListView scrolls very slowly with small amount of items

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.

No sizing grip displaying on DarkStatusStrip

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?

how to refresh data in terms of plotview on DockDocument?

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!

The Tiled and the script editor

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?

DarkDockPanel add DarkDocument NullReferenceException within DarkControl

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.

C++ / CLI compatibility

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

New Control : ComboBox

Hello, friend

Are there any ideas for adding or other implementations of workarounds for a control?

Thanks you.

DarkButton icon spacing

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.

Current DarkButton:
image

Padding Changes with Current DarkButton. Left button has a padding of 5 and right button has a padding of 20:
image

DarkButton with Changes as per Code Below:
image

Padding Changes with DarkButton as per Code Below. Left button has a padding of 5 and right button has a padding of 20:
image

        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);
            }
        }

DarkTreeView SelectedNodesChanged event fired between selection

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.

High DPI scale doesn't work

I just tried DarkUI, and if the DPI scale in Windows is set to > 100%, and the Application is set to be DPI aware - the DarkUI completely breaks, as it's not responding to Font scale.

DarkUI_hdpi

Scrollbar of DarkListView doesn't work properly

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?)

Combobox does not honor 'Displaymember'

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;

  • PaintCombobox()
  • OnDrawItem(DrawItemEventArgs e)()

Initial size of DarkToolWindow

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?

Dark ComboBox missing

Thanks for the cool library, but i'm really mssing a dark DropDown ComboBox.
Any chance to add this ?

No scroll event

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.

[Feature] List view index from point

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.

DarkComboBox Not Drawing Correctly

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:

image

And here it is after the form is resized:

image

[FEATURE REQUEST] .NET 5 support?

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 :).

New Control : DarkDataGridView

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.

darkScrollBar Properties

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.

dotnet build / dotnet msbuild failing

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!

Hover Icon

The active control for the radio buttons and check box do not remove their highlight unless you click somewhere or press tab.

DarkSectionPanel Anchor Doesn't Work Properly?

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.

No DarkComboBox

When I get the package form NuGet, there's a DarkComboBox control. However, this control isn't found in the repository.

syntax highlighting

Is the lua screenshot of syntax highlighting part of the darkui library or is it the editor itself?

darkScrollbar - How to link to listView ?

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:
image

I've managed to setup Dark UI using your descriptions, and now it looks like this:
image

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?

DarkCheckBox change BackColor?

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 CheckBoxes.

Error al querer colocar un ToolStrip en el formulario.

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..

ToolStripSplitButton is not displaying dropdown arrow

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.

Additional standard dialogs

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.