mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Using enum for screen test mode
This commit is contained in:
parent
d452087e75
commit
eefb810afa
5 changed files with 39 additions and 32 deletions
|
@ -173,4 +173,10 @@ public enum SlashType
|
||||||
Prefix,
|
Prefix,
|
||||||
Suffix
|
Suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ScreenTearingTestMode
|
||||||
|
{
|
||||||
|
VerticalLines,
|
||||||
|
HorizontalLines
|
||||||
|
}
|
||||||
}
|
}
|
36
ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs
generated
36
ShareX.HelpersLib/Forms/MonitorTestForm.Designer.cs
generated
|
@ -31,6 +31,8 @@ private void InitializeComponent()
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MonitorTestForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MonitorTestForm));
|
||||||
this.pSettings = new System.Windows.Forms.Panel();
|
this.pSettings = new System.Windows.Forms.Panel();
|
||||||
this.btnScreenTearingTest = new System.Windows.Forms.Button();
|
this.btnScreenTearingTest = new System.Windows.Forms.Button();
|
||||||
|
this.btnGradientColor2 = new ShareX.HelpersLib.ColorButton();
|
||||||
|
this.btnGradientColor1 = new ShareX.HelpersLib.ColorButton();
|
||||||
this.lblTip = new System.Windows.Forms.Label();
|
this.lblTip = new System.Windows.Forms.Label();
|
||||||
this.cbGradient = new System.Windows.Forms.ComboBox();
|
this.cbGradient = new System.Windows.Forms.ComboBox();
|
||||||
this.rbGradient = new System.Windows.Forms.RadioButton();
|
this.rbGradient = new System.Windows.Forms.RadioButton();
|
||||||
|
@ -54,8 +56,6 @@ private void InitializeComponent()
|
||||||
this.lblBlackWhiteValue = new System.Windows.Forms.Label();
|
this.lblBlackWhiteValue = new System.Windows.Forms.Label();
|
||||||
this.tbBlackWhite = new System.Windows.Forms.TrackBar();
|
this.tbBlackWhite = new System.Windows.Forms.TrackBar();
|
||||||
this.rbBlackWhite = new System.Windows.Forms.RadioButton();
|
this.rbBlackWhite = new System.Windows.Forms.RadioButton();
|
||||||
this.btnGradientColor2 = new ShareX.HelpersLib.ColorButton();
|
|
||||||
this.btnGradientColor1 = new ShareX.HelpersLib.ColorButton();
|
|
||||||
this.pSettings.SuspendLayout();
|
this.pSettings.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.tbShapeSize)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.tbShapeSize)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.tbBlue)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.tbBlue)).BeginInit();
|
||||||
|
@ -104,6 +104,22 @@ private void InitializeComponent()
|
||||||
this.btnScreenTearingTest.UseVisualStyleBackColor = true;
|
this.btnScreenTearingTest.UseVisualStyleBackColor = true;
|
||||||
this.btnScreenTearingTest.Click += new System.EventHandler(this.btnScreenTearingTest_Click);
|
this.btnScreenTearingTest.Click += new System.EventHandler(this.btnScreenTearingTest_Click);
|
||||||
//
|
//
|
||||||
|
// btnGradientColor2
|
||||||
|
//
|
||||||
|
this.btnGradientColor2.Color = System.Drawing.Color.Empty;
|
||||||
|
resources.ApplyResources(this.btnGradientColor2, "btnGradientColor2");
|
||||||
|
this.btnGradientColor2.Name = "btnGradientColor2";
|
||||||
|
this.btnGradientColor2.UseVisualStyleBackColor = true;
|
||||||
|
this.btnGradientColor2.ColorChanged += new ShareX.HelpersLib.ColorButton.ColorChangedEventHandler(this.btnGradientColor2_ColorChanged);
|
||||||
|
//
|
||||||
|
// btnGradientColor1
|
||||||
|
//
|
||||||
|
this.btnGradientColor1.Color = System.Drawing.Color.Empty;
|
||||||
|
resources.ApplyResources(this.btnGradientColor1, "btnGradientColor1");
|
||||||
|
this.btnGradientColor1.Name = "btnGradientColor1";
|
||||||
|
this.btnGradientColor1.UseVisualStyleBackColor = true;
|
||||||
|
this.btnGradientColor1.ColorChanged += new ShareX.HelpersLib.ColorButton.ColorChangedEventHandler(this.btnGradientColor1_ColorChanged);
|
||||||
|
//
|
||||||
// lblTip
|
// lblTip
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.lblTip, "lblTip");
|
resources.ApplyResources(this.lblTip, "lblTip");
|
||||||
|
@ -258,22 +274,6 @@ private void InitializeComponent()
|
||||||
this.rbBlackWhite.UseVisualStyleBackColor = true;
|
this.rbBlackWhite.UseVisualStyleBackColor = true;
|
||||||
this.rbBlackWhite.CheckedChanged += new System.EventHandler(this.rbBlackWhite_CheckedChanged);
|
this.rbBlackWhite.CheckedChanged += new System.EventHandler(this.rbBlackWhite_CheckedChanged);
|
||||||
//
|
//
|
||||||
// btnGradientColor2
|
|
||||||
//
|
|
||||||
this.btnGradientColor2.Color = System.Drawing.Color.Empty;
|
|
||||||
resources.ApplyResources(this.btnGradientColor2, "btnGradientColor2");
|
|
||||||
this.btnGradientColor2.Name = "btnGradientColor2";
|
|
||||||
this.btnGradientColor2.UseVisualStyleBackColor = true;
|
|
||||||
this.btnGradientColor2.ColorChanged += new ShareX.HelpersLib.ColorButton.ColorChangedEventHandler(this.btnGradientColor2_ColorChanged);
|
|
||||||
//
|
|
||||||
// btnGradientColor1
|
|
||||||
//
|
|
||||||
this.btnGradientColor1.Color = System.Drawing.Color.Empty;
|
|
||||||
resources.ApplyResources(this.btnGradientColor1, "btnGradientColor1");
|
|
||||||
this.btnGradientColor1.Name = "btnGradientColor1";
|
|
||||||
this.btnGradientColor1.UseVisualStyleBackColor = true;
|
|
||||||
this.btnGradientColor1.ColorChanged += new ShareX.HelpersLib.ColorButton.ColorChangedEventHandler(this.btnGradientColor1_ColorChanged);
|
|
||||||
//
|
|
||||||
// MonitorTestForm
|
// MonitorTestForm
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
|
|
|
@ -49,7 +49,7 @@ public MonitorTestForm()
|
||||||
btnGradientColor1.Color = Color.DarkGray;
|
btnGradientColor1.Color = Color.DarkGray;
|
||||||
btnGradientColor2.Color = Color.Black;
|
btnGradientColor2.Color = Color.Black;
|
||||||
cbShapes.SelectedIndex = 0;
|
cbShapes.SelectedIndex = 0;
|
||||||
tbShapeSize.Value = 3;
|
tbShapeSize.Value = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetBackColor()
|
private void SetBackColor()
|
||||||
|
@ -173,14 +173,14 @@ private void DrawSelectedShape()
|
||||||
switch (cbShapes.SelectedIndex)
|
switch (cbShapes.SelectedIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
BackgroundImage = DrawChecker(shapeSize, Color.Black);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
BackgroundImage = DrawHorizontalLine(shapeSize, Color.Black);
|
BackgroundImage = DrawHorizontalLine(shapeSize, Color.Black);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 1:
|
||||||
BackgroundImage = DrawVerticalLine(shapeSize, Color.Black);
|
BackgroundImage = DrawVerticalLine(shapeSize, Color.Black);
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
BackgroundImage = DrawChecker(shapeSize, Color.Black);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,14 +436,14 @@
|
||||||
<value>10</value>
|
<value>10</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="cbShapes.Items" xml:space="preserve">
|
<data name="cbShapes.Items" xml:space="preserve">
|
||||||
<value>Checker</value>
|
|
||||||
</data>
|
|
||||||
<data name="cbShapes.Items1" xml:space="preserve">
|
|
||||||
<value>Horizontal lines</value>
|
<value>Horizontal lines</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="cbShapes.Items2" xml:space="preserve">
|
<data name="cbShapes.Items1" xml:space="preserve">
|
||||||
<value>Vertical lines</value>
|
<value>Vertical lines</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="cbShapes.Items2" xml:space="preserve">
|
||||||
|
<value>Checker</value>
|
||||||
|
</data>
|
||||||
<data name="cbShapes.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="cbShapes.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>120, 295</value>
|
<value>120, 295</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -33,12 +33,13 @@ namespace ShareX.HelpersLib
|
||||||
{
|
{
|
||||||
public class ScreenTearingTestForm : Form
|
public class ScreenTearingTestForm : Form
|
||||||
{
|
{
|
||||||
|
public ScreenTearingTestMode Mode { get; set; } = ScreenTearingTestMode.VerticalLines;
|
||||||
|
|
||||||
private Rectangle screenRectangle, screenRectangle0Based;
|
private Rectangle screenRectangle, screenRectangle0Based;
|
||||||
private Stopwatch animationTime;
|
private Stopwatch animationTime;
|
||||||
private TimeSpan lastElapsed;
|
private TimeSpan lastElapsed;
|
||||||
private int rectangleSize = 50;
|
private int rectangleSize = 50;
|
||||||
private float animationSpeed = 500, minSpeed = 100, maxSpeed = 2000, speedChange = 50, currentPosition;
|
private float animationSpeed = 500, minSpeed = 100, maxSpeed = 2000, speedChange = 50, currentPosition;
|
||||||
private bool isVerticalLines = true;
|
|
||||||
|
|
||||||
public ScreenTearingTestForm()
|
public ScreenTearingTestForm()
|
||||||
{
|
{
|
||||||
|
@ -85,9 +86,9 @@ protected override void OnKeyUp(KeyEventArgs e)
|
||||||
|
|
||||||
protected override void OnMouseUp(MouseEventArgs e)
|
protected override void OnMouseUp(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (isVerticalLines)
|
if (Mode == ScreenTearingTestMode.VerticalLines)
|
||||||
{
|
{
|
||||||
isVerticalLines = false;
|
Mode = ScreenTearingTestMode.HorizontalLines;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -124,14 +125,14 @@ protected override void OnPaint(PaintEventArgs e)
|
||||||
int nextPosition = rectangleSize * 2;
|
int nextPosition = rectangleSize * 2;
|
||||||
int startOffset = (int)(currentPosition % nextPosition);
|
int startOffset = (int)(currentPosition % nextPosition);
|
||||||
|
|
||||||
if (isVerticalLines)
|
if (Mode == ScreenTearingTestMode.VerticalLines)
|
||||||
{
|
{
|
||||||
for (int x = startOffset - rectangleSize; x < screenRectangle.Width; x += nextPosition)
|
for (int x = startOffset - rectangleSize; x < screenRectangle.Width; x += nextPosition)
|
||||||
{
|
{
|
||||||
g.FillRectangle(Brushes.Black, x, 0, rectangleSize, screenRectangle.Height);
|
g.FillRectangle(Brushes.Black, x, 0, rectangleSize, screenRectangle.Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Mode == ScreenTearingTestMode.HorizontalLines)
|
||||||
{
|
{
|
||||||
for (int y = startOffset - rectangleSize; y < screenRectangle.Height; y += nextPosition)
|
for (int y = startOffset - rectangleSize; y < screenRectangle.Height; y += nextPosition)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue