mirror of
https://github.com/colhountech/DarkUI.Net5.git
synced 2025-07-04 16:19:25 +03:00
Scrollbars will now visually looked disabled.
Can now choose to have scrollbars always visible in scrollbase.
This commit is contained in:
parent
3a409516cc
commit
94670aac43
@ -388,16 +388,8 @@ namespace DarkUI.Controls
|
|||||||
|
|
||||||
public void UpdateScrollBar()
|
public void UpdateScrollBar()
|
||||||
{
|
{
|
||||||
if (ViewSize >= Maximum)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var area = ClientRectangle;
|
var area = ClientRectangle;
|
||||||
|
|
||||||
// Cap to maximum value
|
|
||||||
var maximumValue = Maximum - ViewSize;
|
|
||||||
if (Value > maximumValue)
|
|
||||||
Value = maximumValue;
|
|
||||||
|
|
||||||
// Arrow buttons
|
// Arrow buttons
|
||||||
if (_scrollOrientation == DarkScrollOrientation.Vertical)
|
if (_scrollOrientation == DarkScrollOrientation.Vertical)
|
||||||
{
|
{
|
||||||
@ -428,6 +420,14 @@ namespace DarkUI.Controls
|
|||||||
|
|
||||||
private void UpdateThumb(bool forceRefresh = false)
|
private void UpdateThumb(bool forceRefresh = false)
|
||||||
{
|
{
|
||||||
|
if (ViewSize >= Maximum)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Cap to maximum value
|
||||||
|
var maximumValue = Maximum - ViewSize;
|
||||||
|
if (Value > maximumValue)
|
||||||
|
Value = maximumValue;
|
||||||
|
|
||||||
// Calculate size ratio
|
// Calculate size ratio
|
||||||
_viewContentRatio = (float)ViewSize / (float)Maximum;
|
_viewContentRatio = (float)ViewSize / (float)Maximum;
|
||||||
var viewAreaSize = Maximum - ViewSize;
|
var viewAreaSize = Maximum - ViewSize;
|
||||||
@ -493,6 +493,9 @@ namespace DarkUI.Controls
|
|||||||
if (_upArrowClicked)
|
if (_upArrowClicked)
|
||||||
upIcon = ScrollIcons.scrollbar_arrow_clicked;
|
upIcon = ScrollIcons.scrollbar_arrow_clicked;
|
||||||
|
|
||||||
|
if (!Enabled)
|
||||||
|
upIcon = ScrollIcons.scrollbar_arrow_disabled;
|
||||||
|
|
||||||
if (_scrollOrientation == DarkScrollOrientation.Vertical)
|
if (_scrollOrientation == DarkScrollOrientation.Vertical)
|
||||||
upIcon.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
upIcon.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||||
else if (_scrollOrientation == DarkScrollOrientation.Horizontal)
|
else if (_scrollOrientation == DarkScrollOrientation.Horizontal)
|
||||||
@ -508,6 +511,9 @@ namespace DarkUI.Controls
|
|||||||
if (_downArrowClicked)
|
if (_downArrowClicked)
|
||||||
downIcon = ScrollIcons.scrollbar_arrow_clicked;
|
downIcon = ScrollIcons.scrollbar_arrow_clicked;
|
||||||
|
|
||||||
|
if (!Enabled)
|
||||||
|
downIcon = ScrollIcons.scrollbar_arrow_disabled;
|
||||||
|
|
||||||
if (_scrollOrientation == DarkScrollOrientation.Horizontal)
|
if (_scrollOrientation == DarkScrollOrientation.Horizontal)
|
||||||
downIcon.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
downIcon.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||||||
|
|
||||||
@ -516,6 +522,8 @@ namespace DarkUI.Controls
|
|||||||
_downArrowArea.Top + (_downArrowArea.Height / 2) - (downIcon.Height / 2));
|
_downArrowArea.Top + (_downArrowArea.Height / 2) - (downIcon.Height / 2));
|
||||||
|
|
||||||
// Draw thumb
|
// Draw thumb
|
||||||
|
if (Enabled)
|
||||||
|
{
|
||||||
var scrollColor = _thumbHot ? Colors.GreyHighlight : Colors.GreySelection;
|
var scrollColor = _thumbHot ? Colors.GreyHighlight : Colors.GreySelection;
|
||||||
|
|
||||||
if (_isScrolling)
|
if (_isScrolling)
|
||||||
@ -526,6 +534,7 @@ namespace DarkUI.Controls
|
|||||||
g.FillRectangle(b, _thumbArea);
|
g.FillRectangle(b, _thumbArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ namespace DarkUI.Controls
|
|||||||
private int _maxDragChange = 0;
|
private int _maxDragChange = 0;
|
||||||
private Timer _dragTimer;
|
private Timer _dragTimer;
|
||||||
|
|
||||||
|
private bool _hideScrollBars = true;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Property Region
|
#region Property Region
|
||||||
@ -88,6 +90,19 @@ namespace DarkUI.Controls
|
|||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
public bool IsDragging { get; private set; }
|
public bool IsDragging { get; private set; }
|
||||||
|
|
||||||
|
[Category("Behavior")]
|
||||||
|
[Description("Determines whether scrollbars will remain visible when disabled.")]
|
||||||
|
[DefaultValue(true)]
|
||||||
|
public bool HideScrollBars
|
||||||
|
{
|
||||||
|
get { return _hideScrollBars; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_hideScrollBars = value;
|
||||||
|
UpdateScrollBars();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor Region
|
#region Constructor Region
|
||||||
@ -159,8 +174,14 @@ namespace DarkUI.Controls
|
|||||||
|
|
||||||
private void SetScrollBarVisibility()
|
private void SetScrollBarVisibility()
|
||||||
{
|
{
|
||||||
_vScrollBar.Visible = _visibleSize.Height < ContentSize.Height;
|
_vScrollBar.Enabled = _visibleSize.Height < ContentSize.Height;
|
||||||
_hScrollBar.Visible = _visibleSize.Width < ContentSize.Width;
|
_hScrollBar.Enabled = _visibleSize.Width < ContentSize.Width;
|
||||||
|
|
||||||
|
if (_hideScrollBars)
|
||||||
|
{
|
||||||
|
_vScrollBar.Visible = _vScrollBar.Enabled;
|
||||||
|
_hScrollBar.Visible = _hScrollBar.Enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetVisibleSize()
|
private void SetVisibleSize()
|
||||||
|
@ -309,6 +309,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\small_arrow.png" />
|
<None Include="Resources\small_arrow.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\scrollbar_disabled.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
12
DarkUI/Icons/ScrollIcons.Designer.cs
generated
12
DarkUI/Icons/ScrollIcons.Designer.cs
generated
@ -8,7 +8,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace DarkUI.Icons {
|
namespace DarkUI {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
@ -80,6 +80,16 @@ namespace DarkUI.Icons {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap scrollbar_arrow_disabled {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("scrollbar_arrow_disabled", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -124,6 +124,9 @@
|
|||||||
<data name="scrollbar_arrow_clicked" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="scrollbar_arrow_clicked" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\scrollbar_arrow_clicked.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\scrollbar_arrow_clicked.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="scrollbar_arrow_disabled" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\scrollbar_disabled.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="scrollbar_arrow_hot" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="scrollbar_arrow_hot" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\scrollbar_arrow_hot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\scrollbar_arrow_hot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
BIN
DarkUI/Resources/scrollbar_disabled.png
Normal file
BIN
DarkUI/Resources/scrollbar_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
1
Example/Forms/Docking/DockLayers.Designer.cs
generated
1
Example/Forms/Docking/DockLayers.Designer.cs
generated
@ -38,6 +38,7 @@ namespace Example
|
|||||||
// lstLayers
|
// lstLayers
|
||||||
//
|
//
|
||||||
this.lstLayers.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.lstLayers.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.lstLayers.HideScrollBars = false;
|
||||||
this.lstLayers.Location = new System.Drawing.Point(0, 51);
|
this.lstLayers.Location = new System.Drawing.Point(0, 51);
|
||||||
this.lstLayers.Name = "lstLayers";
|
this.lstLayers.Name = "lstLayers";
|
||||||
this.lstLayers.ShowIcons = true;
|
this.lstLayers.ShowIcons = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user