diff --git a/DarkUI/Config/Enums.cs b/DarkUI/Config/Enums.cs deleted file mode 100644 index 3856673..0000000 --- a/DarkUI/Config/Enums.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace DarkUI.Config -{ - public enum DarkButtonStyle - { - Normal, - Flat - } - - public enum DarkControlState - { - Normal, - Hover, - Pressed - } - - public enum DarkContentAlignment - { - Center, - Left, - Right - } - - public enum DarkOrientation - { - Vertical, - Horizontal - } - - public enum DarkDialogButton - { - Ok, - Close, - OkCancel, - YesNo, - YesNoCancel, - AbortRetryIgnore, - RetryCancel - } - - public enum DarkMessageBoxIcon - { - None, - Information, - Warning, - Error - } - - public enum DarkDockArea - { - Document, - Left, - Right, - Bottom - } - - public enum DarkSplitterType - { - Left, - Right, - Top, - Bottom - } -} diff --git a/DarkUI/Controls/DarkButton.cs b/DarkUI/Controls/DarkButton.cs index 6f84d45..610a82c 100644 --- a/DarkUI/Controls/DarkButton.cs +++ b/DarkUI/Controls/DarkButton.cs @@ -6,6 +6,12 @@ using System.Windows.Forms; namespace DarkUI.Controls { + public enum DarkButtonStyle + { + Normal, + Flat + } + [ToolboxBitmap(typeof(Button))] [DefaultEvent("Click")] public class DarkButton : Button diff --git a/DarkUI/Controls/DarkControl.cs b/DarkUI/Controls/DarkControl.cs new file mode 100644 index 0000000..7738bb2 --- /dev/null +++ b/DarkUI/Controls/DarkControl.cs @@ -0,0 +1,41 @@ +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace DarkUI.Controls +{ + public enum DarkControlState + { + Normal, + Hover, + Pressed + } + + public enum DarkContentAlignment + { + Center, + Left, + Right + } + + public class DarkControl : Control + { + #region Property Region + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new Image BackgroundImage + { + get { return base.BackgroundImage; } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ImageLayout BackgroundImageLayout + { + get { return base.BackgroundImageLayout; } + } + + #endregion + } +} diff --git a/DarkUI/Controls/Items/DarkListItem.cs b/DarkUI/Controls/DarkListItem.cs similarity index 100% rename from DarkUI/Controls/Items/DarkListItem.cs rename to DarkUI/Controls/DarkListItem.cs diff --git a/DarkUI/Controls/DarkScrollBar.cs b/DarkUI/Controls/DarkScrollBar.cs index 3649f39..20f9f19 100644 --- a/DarkUI/Controls/DarkScrollBar.cs +++ b/DarkUI/Controls/DarkScrollBar.cs @@ -7,7 +7,23 @@ using System.Windows.Forms; namespace DarkUI.Controls { - public class DarkScrollBar : Control + public enum DarkScrollOrientation + { + Vertical, + Horizontal + } + + public class ScrollValueEventArgs : EventArgs + { + public int Value { get; private set; } + + public ScrollValueEventArgs(int value) + { + Value = value; + } + } + + public class DarkScrollBar : DarkControl { #region Event Region @@ -17,7 +33,7 @@ namespace DarkUI.Controls #region Field Region - private DarkOrientation _scrollOrientation; + private DarkScrollOrientation _scrollOrientation; private int _value; private int _minimum = 0; @@ -52,8 +68,8 @@ namespace DarkUI.Controls [Category("Behavior")] [Description("The orientation type of the scrollbar.")] - [DefaultValue(DarkOrientation.Vertical)] - public DarkOrientation ScrollOrientation + [DefaultValue(DarkScrollOrientation.Vertical)] + public DarkScrollOrientation ScrollOrientation { get { return _scrollOrientation; } set @@ -178,7 +194,7 @@ namespace DarkUI.Controls _isScrolling = true; _initialContact = e.Location; - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) _initialValue = _thumbArea.Top; else _initialValue = _thumbArea.Left; @@ -208,13 +224,13 @@ namespace DarkUI.Controls if (_trackArea.Contains(e.Location) && e.Button == MouseButtons.Left) { // Step 1. Check if our input is at least aligned with the thumb - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) { var modRect = new Rectangle(_thumbArea.Left, _trackArea.Top, _thumbArea.Width, _trackArea.Height); if (!modRect.Contains(e.Location)) return; } - else if (_scrollOrientation == DarkOrientation.Horizontal) + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) { var modRect = new Rectangle(_trackArea.Left, _thumbArea.Top, _trackArea.Width, _thumbArea.Height); if (!modRect.Contains(e.Location)) @@ -222,7 +238,7 @@ namespace DarkUI.Controls } // Step 2. Scroll to the area initially clicked. - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) { var loc = e.Location.Y; loc -= _upArrowArea.Bottom - 1; @@ -242,7 +258,7 @@ namespace DarkUI.Controls _initialContact = e.Location; _thumbHot = true; - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) _initialValue = _thumbArea.Top; else _initialValue = _thumbArea.Left; @@ -303,14 +319,14 @@ namespace DarkUI.Controls var difference = new Point(e.Location.X - _initialContact.X, e.Location.Y - _initialContact.Y); - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) { var thumbPos = (_initialValue - _trackArea.Top); var newPosition = thumbPos + difference.Y; ScrollToPhysical(newPosition); } - else if (_scrollOrientation == DarkOrientation.Horizontal) + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) { var thumbPos = (_initialValue - _trackArea.Left); var newPosition = thumbPos + difference.X; @@ -358,7 +374,7 @@ namespace DarkUI.Controls public void ScrollToPhysical(int positionInPixels) { - var isVert = _scrollOrientation == DarkOrientation.Vertical; + var isVert = _scrollOrientation == DarkScrollOrientation.Vertical; var trackAreaSize = isVert ? _trackArea.Height - _thumbArea.Height : _trackArea.Width - _thumbArea.Width; @@ -377,7 +393,7 @@ namespace DarkUI.Controls public void ScrollByPhysical(int offsetInPixels) { - var isVert = _scrollOrientation == DarkOrientation.Vertical; + var isVert = _scrollOrientation == DarkScrollOrientation.Vertical; var thumbPos = isVert ? (_thumbArea.Top - _trackArea.Top) : (_thumbArea.Left - _trackArea.Left); @@ -399,23 +415,23 @@ namespace DarkUI.Controls Value = maximumValue; // Arrow buttons - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) { _upArrowArea = new Rectangle(area.Left, area.Top, Consts.ArrowButtonSize, Consts.ArrowButtonSize); _downArrowArea = new Rectangle(area.Left, area.Bottom - Consts.ArrowButtonSize, Consts.ArrowButtonSize, Consts.ArrowButtonSize); } - else if (_scrollOrientation == DarkOrientation.Horizontal) + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) { _upArrowArea = new Rectangle(area.Left, area.Top, Consts.ArrowButtonSize, Consts.ArrowButtonSize); _downArrowArea = new Rectangle(area.Right - Consts.ArrowButtonSize, area.Top, Consts.ArrowButtonSize, Consts.ArrowButtonSize); } // Track - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) { _trackArea = new Rectangle(area.Left, area.Top + Consts.ArrowButtonSize, area.Width, area.Height - (Consts.ArrowButtonSize * 2)); } - else if (_scrollOrientation == DarkOrientation.Horizontal) + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) { _trackArea = new Rectangle(area.Left + Consts.ArrowButtonSize, area.Top, area.Width - (Consts.ArrowButtonSize * 2), area.Height); } @@ -434,7 +450,7 @@ namespace DarkUI.Controls var positionRatio = (float)Value / (float)viewAreaSize; // Update area - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) { var thumbSize = (int)(_trackArea.Height * _viewContentRatio); @@ -446,7 +462,7 @@ namespace DarkUI.Controls _thumbArea = new Rectangle(_trackArea.Left + 3, _trackArea.Top + thumbPosition, Consts.ScrollBarSize - 6, thumbSize); } - else if (_scrollOrientation == DarkOrientation.Horizontal) + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) { var thumbSize = (int)(_trackArea.Width * _viewContentRatio); @@ -493,9 +509,9 @@ namespace DarkUI.Controls if (_upArrowClicked) upIcon = ScrollIcons.scrollbar_arrow_clicked; - if (_scrollOrientation == DarkOrientation.Vertical) + if (_scrollOrientation == DarkScrollOrientation.Vertical) upIcon.RotateFlip(RotateFlipType.RotateNoneFlipY); - else if (_scrollOrientation == DarkOrientation.Horizontal) + else if (_scrollOrientation == DarkScrollOrientation.Horizontal) upIcon.RotateFlip(RotateFlipType.Rotate90FlipNone); g.DrawImageUnscaled(upIcon, @@ -508,7 +524,7 @@ namespace DarkUI.Controls if (_downArrowClicked) downIcon = ScrollIcons.scrollbar_arrow_clicked; - if (_scrollOrientation == DarkOrientation.Horizontal) + if (_scrollOrientation == DarkScrollOrientation.Horizontal) downIcon.RotateFlip(RotateFlipType.Rotate270FlipNone); g.DrawImageUnscaled(downIcon, diff --git a/DarkUI/Controls/DarkScrollBase.cs b/DarkUI/Controls/DarkScrollBase.cs index c78e50f..560c354 100644 --- a/DarkUI/Controls/DarkScrollBase.cs +++ b/DarkUI/Controls/DarkScrollBase.cs @@ -6,7 +6,7 @@ using System.Windows.Forms; namespace DarkUI.Controls { - public abstract class DarkScrollBase : Control + public abstract class DarkScrollBase : DarkControl { #region Event Region @@ -97,8 +97,8 @@ namespace DarkUI.Controls SetStyle(ControlStyles.Selectable | ControlStyles.UserMouse, true); - _vScrollBar = new DarkScrollBar { ScrollOrientation = DarkOrientation.Vertical }; - _hScrollBar = new DarkScrollBar { ScrollOrientation = DarkOrientation.Horizontal }; + _vScrollBar = new DarkScrollBar { ScrollOrientation = DarkScrollOrientation.Vertical }; + _hScrollBar = new DarkScrollBar { ScrollOrientation = DarkScrollOrientation.Horizontal }; Controls.Add(_vScrollBar); Controls.Add(_hScrollBar); diff --git a/DarkUI/Controls/DarkSeparator.cs b/DarkUI/Controls/DarkSeparator.cs index adf17ae..10921fd 100644 --- a/DarkUI/Controls/DarkSeparator.cs +++ b/DarkUI/Controls/DarkSeparator.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; namespace DarkUI.Controls { - public class DarkSeparator : Control + public class DarkSeparator : DarkControl { #region Constructor Region diff --git a/DarkUI/Controls/Items/DarkTreeNode.cs b/DarkUI/Controls/DarkTreeNode.cs similarity index 100% rename from DarkUI/Controls/Items/DarkTreeNode.cs rename to DarkUI/Controls/DarkTreeNode.cs diff --git a/DarkUI/Controls/EventArgs/ScrollValueEventArgs.cs b/DarkUI/Controls/EventArgs/ScrollValueEventArgs.cs deleted file mode 100644 index 6e9b784..0000000 --- a/DarkUI/Controls/EventArgs/ScrollValueEventArgs.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace DarkUI.Controls -{ - public class ScrollValueEventArgs : EventArgs - { - public int Value { get; private set; } - - public ScrollValueEventArgs(int value) - { - Value = value; - } - } -} diff --git a/DarkUI/DarkUI.csproj b/DarkUI/DarkUI.csproj index 950ebce..b0bd3eb 100644 --- a/DarkUI/DarkUI.csproj +++ b/DarkUI/DarkUI.csproj @@ -42,10 +42,12 @@ - Component + + Component + Component @@ -55,7 +57,7 @@ Component - + Component @@ -74,9 +76,7 @@ Component - - Component - + Component @@ -95,11 +95,8 @@ Component - - - - UserControl - + + Component @@ -115,10 +112,9 @@ UserControl - - - - + + + @@ -139,6 +135,7 @@ Form + True True diff --git a/DarkUI/Docking/DarkDockContent.cs b/DarkUI/Docking/DarkDockContent.cs index b1d11a8..45f0c08 100644 --- a/DarkUI/Docking/DarkDockContent.cs +++ b/DarkUI/Docking/DarkDockContent.cs @@ -1,11 +1,20 @@ -using DarkUI.Config; -using System; +using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace DarkUI.Docking { + public class DockContentEventArgs : EventArgs + { + public DarkDockContent Content { get; private set; } + + public DockContentEventArgs(DarkDockContent content) + { + Content = content; + } + } + [ToolboxItem(false)] public class DarkDockContent : UserControl { diff --git a/DarkUI/Docking/DarkDockPanel.cs b/DarkUI/Docking/DarkDockPanel.cs index 2eaa833..d43be7c 100644 --- a/DarkUI/Docking/DarkDockPanel.cs +++ b/DarkUI/Docking/DarkDockPanel.cs @@ -7,6 +7,14 @@ using System.Windows.Forms; namespace DarkUI.Docking { + public enum DarkDockArea + { + Document, + Left, + Right, + Bottom + } + public class DarkDockPanel : UserControl { #region Event Region diff --git a/DarkUI/Docking/Items/DarkDockSplitter.cs b/DarkUI/Docking/DarkDockSplitter.cs similarity index 97% rename from DarkUI/Docking/Items/DarkDockSplitter.cs rename to DarkUI/Docking/DarkDockSplitter.cs index 7d800c8..f1746a2 100644 --- a/DarkUI/Docking/Items/DarkDockSplitter.cs +++ b/DarkUI/Docking/DarkDockSplitter.cs @@ -1,11 +1,18 @@ -using DarkUI.Config; -using DarkUI.Forms; +using DarkUI.Forms; using System; using System.Drawing; using System.Windows.Forms; namespace DarkUI.Docking { + public enum DarkSplitterType + { + Left, + Right, + Top, + Bottom + } + public class DarkDockSplitter { #region Field Region diff --git a/DarkUI/Docking/Items/DarkDockTab.cs b/DarkUI/Docking/DarkDockTab.cs similarity index 100% rename from DarkUI/Docking/Items/DarkDockTab.cs rename to DarkUI/Docking/DarkDockTab.cs diff --git a/DarkUI/Docking/Items/DarkDockTabArea.cs b/DarkUI/Docking/DarkDockTabArea.cs similarity index 100% rename from DarkUI/Docking/Items/DarkDockTabArea.cs rename to DarkUI/Docking/DarkDockTabArea.cs diff --git a/DarkUI/Docking/EventArgs/DockContentEventArgs.cs b/DarkUI/Docking/EventArgs/DockContentEventArgs.cs deleted file mode 100644 index 13ae74d..0000000 --- a/DarkUI/Docking/EventArgs/DockContentEventArgs.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace DarkUI.Docking -{ - public class DockContentEventArgs : EventArgs - { - public DarkDockContent Content { get; private set; } - - public DockContentEventArgs(DarkDockContent content) - { - Content = content; - } - } -} diff --git a/DarkUI/Forms/DarkDialog.cs b/DarkUI/Forms/DarkDialog.cs index 667e679..e728dd1 100644 --- a/DarkUI/Forms/DarkDialog.cs +++ b/DarkUI/Forms/DarkDialog.cs @@ -1,11 +1,21 @@ -using DarkUI.Config; -using DarkUI.Controls; +using DarkUI.Controls; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; namespace DarkUI.Forms { + public enum DarkDialogButton + { + Ok, + Close, + OkCancel, + YesNo, + YesNoCancel, + AbortRetryIgnore, + RetryCancel + } + public partial class DarkDialog : DarkForm { #region Field Region diff --git a/DarkUI/Forms/DarkMessageBox.cs b/DarkUI/Forms/DarkMessageBox.cs index 0ac0ae2..e6d1d55 100644 --- a/DarkUI/Forms/DarkMessageBox.cs +++ b/DarkUI/Forms/DarkMessageBox.cs @@ -1,5 +1,4 @@ -using DarkUI.Config; -using DarkUI.Icons; +using DarkUI.Icons; using System; using System.ComponentModel; using System.Drawing; @@ -7,6 +6,14 @@ using System.Windows.Forms; namespace DarkUI.Forms { + public enum DarkMessageBoxIcon + { + None, + Information, + Warning, + Error + } + public partial class DarkMessageBox : DarkDialog { #region Field Region diff --git a/Example/Forms/Docking/DockConsole.Designer.cs b/Example/Forms/Docking/DockConsole.Designer.cs index ef96f59..4164a08 100644 --- a/Example/Forms/Docking/DockConsole.Designer.cs +++ b/Example/Forms/Docking/DockConsole.Designer.cs @@ -1,5 +1,5 @@ -using DarkUI.Config; -using DarkUI.Controls; +using DarkUI.Controls; +using DarkUI.Docking; namespace Example { diff --git a/Example/Forms/Docking/DockHistory.Designer.cs b/Example/Forms/Docking/DockHistory.Designer.cs index 461f574..66e07e5 100644 --- a/Example/Forms/Docking/DockHistory.Designer.cs +++ b/Example/Forms/Docking/DockHistory.Designer.cs @@ -1,5 +1,6 @@ using DarkUI.Config; using DarkUI.Controls; +using DarkUI.Docking; namespace Example { @@ -48,7 +49,7 @@ namespace Example this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.lstHistory); - this.DockArea = DarkUI.Config.DarkDockArea.Right; + this.DockArea = DarkDockArea.Right; this.DockText = "History"; this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Icon = global::Example.Icons.RefactoringLog_12810; diff --git a/Example/Forms/Docking/DockLayers.Designer.cs b/Example/Forms/Docking/DockLayers.Designer.cs index a7cb796..ea3e027 100644 --- a/Example/Forms/Docking/DockLayers.Designer.cs +++ b/Example/Forms/Docking/DockLayers.Designer.cs @@ -1,5 +1,5 @@ -using DarkUI.Config; -using DarkUI.Controls; +using DarkUI.Controls; +using DarkUI.Docking; namespace Example { diff --git a/Example/Forms/Docking/DockProject.Designer.cs b/Example/Forms/Docking/DockProject.Designer.cs index 78a526b..38131ba 100644 --- a/Example/Forms/Docking/DockProject.Designer.cs +++ b/Example/Forms/Docking/DockProject.Designer.cs @@ -1,5 +1,6 @@ using DarkUI.Config; using DarkUI.Controls; +using DarkUI.Docking; namespace Example { diff --git a/Example/Forms/Docking/DockProperties.Designer.cs b/Example/Forms/Docking/DockProperties.Designer.cs index 3f63f5a..7a7c2c0 100644 --- a/Example/Forms/Docking/DockProperties.Designer.cs +++ b/Example/Forms/Docking/DockProperties.Designer.cs @@ -1,4 +1,5 @@ using DarkUI.Config; +using DarkUI.Docking; namespace Example { @@ -176,7 +177,7 @@ namespace Example this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.pnlMain); - this.DockArea = DarkUI.Config.DarkDockArea.Right; + this.DockArea = DarkDockArea.Right; this.DockText = "Properties"; this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Icon = global::Example.Icons.properties_16xLG;