mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 22:21:23 +12:00
Few changes to scroll bars to improve visibility
This commit is contained in:
parent
8af932445b
commit
b29dcf39c2
|
@ -149,7 +149,7 @@ public RegionCaptureForm(RegionCaptureMode mode, RegionCaptureOptions options, I
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
|
|
||||||
AutoScaleMode = AutoScaleMode.None;
|
AutoScaleMode = AutoScaleMode.None;
|
||||||
defaultCursor = Helpers.CreateCursor(Resources.Crosshair);
|
defaultCursor = Helpers.CreateCursor(Resources.Crosshair);
|
||||||
SetDefaultCursor();
|
SetDefaultCursor();
|
||||||
|
@ -1027,51 +1027,51 @@ private void DrawBottomTipAnimation(Graphics g, TextAnimation textAnimation)
|
||||||
private void DrawPanningScrollbars(Graphics g)
|
private void DrawPanningScrollbars(Graphics g)
|
||||||
{
|
{
|
||||||
int paddingSize = 15;
|
int paddingSize = 15;
|
||||||
int scrollbarThickness = 16;
|
int scrollbarThickness = 12;
|
||||||
|
int trackMargin = 2;
|
||||||
|
|
||||||
Rectangle imageRectangleVisible = CanvasRectangle;
|
Rectangle imageRectangleVisible = CanvasRectangle;
|
||||||
imageRectangleVisible.Intersect(ClientArea);
|
imageRectangleVisible.Intersect(ClientArea);
|
||||||
|
|
||||||
Color trackColor = Color.FromArgb(13, 243, 242, 249);
|
using (Brush trackBrush = new SolidBrush(Color.FromArgb(255, 36, 36, 36)))
|
||||||
Color thumbColor = Color.FromArgb(21, 234, 234, 235);
|
using (Brush thumbBrush = new SolidBrush(Color.FromArgb(255, 110, 110, 110)))
|
||||||
|
|
||||||
using (Brush trackBrush = new SolidBrush(trackColor))
|
|
||||||
using (Brush thumbBrush = new SolidBrush(thumbColor))
|
|
||||||
using (Pen trackPen = new Pen(trackBrush))
|
|
||||||
using (Pen thumbPen = new Pen(thumbBrush))
|
|
||||||
{
|
{
|
||||||
if (CanvasRectangle.Left < ClientArea.Left || CanvasRectangle.Right > ClientArea.Right)
|
if (CanvasRectangle.Left < ClientArea.Left || CanvasRectangle.Right > ClientArea.Right)
|
||||||
{
|
{
|
||||||
int trackHorizontalLength = ClientArea.Width - paddingSize * 2 - scrollbarThickness;
|
int trackHorizontalLength = ClientArea.Width - paddingSize * 2 - scrollbarThickness;
|
||||||
int thumbHorizontalLength = Math.Max(scrollbarThickness, (int)((float)imageRectangleVisible.Width / (float)CanvasRectangle.Width * (float)trackHorizontalLength));
|
int thumbHorizontalLength = Math.Max(scrollbarThickness, (int)((float)imageRectangleVisible.Width / CanvasRectangle.Width * trackHorizontalLength));
|
||||||
|
|
||||||
Rectangle trackHorizontalRegion = new Rectangle(new Point(paddingSize, ClientArea.Bottom - (scrollbarThickness + paddingSize)), new Size(trackHorizontalLength, scrollbarThickness));
|
Rectangle trackHorizontalRegion = new Rectangle(new Point(paddingSize, ClientArea.Bottom - (scrollbarThickness + paddingSize)), new Size(trackHorizontalLength, scrollbarThickness));
|
||||||
|
|
||||||
double limitHorizontal = ((float)trackHorizontalLength - (float)thumbHorizontalLength) / 2.0f;
|
double limitHorizontal = (trackHorizontalLength - thumbHorizontalLength) / 2.0f;
|
||||||
double trackHorizontalPositionX = (float)trackHorizontalRegion.Center().X - ((float)thumbHorizontalLength / 2.0f)
|
double trackHorizontalPositionX = trackHorizontalRegion.Center().X - (thumbHorizontalLength / 2.0f) -
|
||||||
- Math.Min(limitHorizontal, Math.Max(-limitHorizontal, CanvasCenterOffset.X / (float)CanvasRectangle.Width * (float)trackHorizontalLength));
|
Math.Min(limitHorizontal, Math.Max(-limitHorizontal, CanvasCenterOffset.X / CanvasRectangle.Width * trackHorizontalLength));
|
||||||
|
|
||||||
Rectangle thumbHorizontalRegion = new Rectangle(new Point((int)trackHorizontalPositionX, ClientArea.Bottom - (scrollbarThickness + paddingSize)), new Size(thumbHorizontalLength, scrollbarThickness));
|
Rectangle thumbHorizontalRegion = new Rectangle(new Point((int)trackHorizontalPositionX, ClientArea.Bottom - (scrollbarThickness + paddingSize)), new Size(thumbHorizontalLength, scrollbarThickness));
|
||||||
|
|
||||||
g.DrawRoundedRectangle(trackBrush, trackPen, trackHorizontalRegion, scrollbarThickness / 2);
|
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||||
g.DrawRoundedRectangle(thumbBrush, thumbPen, thumbHorizontalRegion, scrollbarThickness / 2);
|
g.DrawCapsule(trackBrush, trackHorizontalRegion.Offset(trackMargin));
|
||||||
|
g.DrawCapsule(thumbBrush, thumbHorizontalRegion);
|
||||||
|
g.SmoothingMode = SmoothingMode.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CanvasRectangle.Top < ClientArea.Top || CanvasRectangle.Bottom > ClientArea.Bottom)
|
if (CanvasRectangle.Top < ClientArea.Top || CanvasRectangle.Bottom > ClientArea.Bottom)
|
||||||
{
|
{
|
||||||
int trackVecticalLength = ClientArea.Height - paddingSize * 2 - scrollbarThickness;
|
int trackVecticalLength = ClientArea.Height - paddingSize * 2 - scrollbarThickness;
|
||||||
int thumbVecticalLength = Math.Max(scrollbarThickness, (int)((float)imageRectangleVisible.Height / (float)CanvasRectangle.Height * (float)trackVecticalLength));
|
int thumbVecticalLength = Math.Max(scrollbarThickness, (int)((float)imageRectangleVisible.Height / CanvasRectangle.Height * trackVecticalLength));
|
||||||
|
|
||||||
Rectangle trackVecticalRegion = new Rectangle(new Point(ClientArea.Right - (scrollbarThickness + paddingSize), paddingSize), new Size(scrollbarThickness, trackVecticalLength));
|
Rectangle trackVecticalRegion = new Rectangle(new Point(ClientArea.Right - (scrollbarThickness + paddingSize), paddingSize), new Size(scrollbarThickness, trackVecticalLength));
|
||||||
|
|
||||||
double limitVectical = ((float)trackVecticalLength - (float)thumbVecticalLength) / 2.0f;
|
double limitVectical = (trackVecticalLength - thumbVecticalLength) / 2.0f;
|
||||||
double trackVecticalPositionY = (float)trackVecticalRegion.Center().Y - ((float)thumbVecticalLength / 2.0f)
|
double trackVecticalPositionY = trackVecticalRegion.Center().Y - (thumbVecticalLength / 2.0f) -
|
||||||
- Math.Min(limitVectical, Math.Max(-limitVectical, CanvasCenterOffset.Y / (float)CanvasRectangle.Height * (float)trackVecticalLength));
|
Math.Min(limitVectical, Math.Max(-limitVectical, CanvasCenterOffset.Y / CanvasRectangle.Height * trackVecticalLength));
|
||||||
|
|
||||||
Rectangle thumbVecticalRegion = new Rectangle(new Point(ClientArea.Right - (scrollbarThickness + paddingSize), (int)trackVecticalPositionY), new Size(scrollbarThickness, thumbVecticalLength));
|
Rectangle thumbVecticalRegion = new Rectangle(new Point(ClientArea.Right - (scrollbarThickness + paddingSize), (int)trackVecticalPositionY), new Size(scrollbarThickness, thumbVecticalLength));
|
||||||
|
|
||||||
g.DrawRoundedRectangle(trackBrush, trackPen, trackVecticalRegion, scrollbarThickness / 2);
|
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||||
g.DrawRoundedRectangle(thumbBrush, thumbPen, thumbVecticalRegion, scrollbarThickness / 2);
|
g.DrawCapsule(trackBrush, trackVecticalRegion.Offset(trackMargin));
|
||||||
|
g.DrawCapsule(thumbBrush, thumbVecticalRegion);
|
||||||
|
g.SmoothingMode = SmoothingMode.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue