Added custom circle resize node

This commit is contained in:
Jaex 2017-09-30 17:08:40 +03:00
parent 03a78c8a0c
commit 4ee76af0ea
10 changed files with 24 additions and 8 deletions

View file

@ -84,7 +84,7 @@ internal enum NodePosition
internal enum NodeShape
{
Square, Circle, Diamond
Square, Circle, Diamond, CustomNode
}
public enum FFmpegVideoCodec

View file

@ -19,7 +19,7 @@ namespace ShareX.ScreenCaptureLib.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -99,6 +99,16 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap CircleNode {
get {
object obj = ResourceManager.GetObject("CircleNode", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -609,4 +609,7 @@ Distance: {6:0.00} px / Angle: {7:0.00}°</value>
<data name="cursor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cursor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CircleNode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CircleNode.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -24,6 +24,7 @@
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using ShareX.ScreenCaptureLib.Properties;
using System.Drawing;
namespace ShareX.ScreenCaptureLib
@ -52,11 +53,13 @@ public Point Position
public NodeShape Shape { get; set; }
private static Image customNodeImage = Resources.CircleNode;
public ResizeNode(int x = 0, int y = 0)
{
Size = DefaultSize;
Shape = NodeShape.Square;
Shape = NodeShape.CustomNode;
Position = new Point(x, y);
Size = customNodeImage.Width;
}
public override void Draw(Graphics g)
@ -77,6 +80,9 @@ public override void Draw(Graphics g)
g.DrawDiamond(Pens.White, rect.Offset(-1));
g.DrawDiamond(Pens.Black, rect);
break;
case NodeShape.CustomNode:
g.DrawImage(customNodeImage, Rectangle);
break;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -214,7 +214,6 @@ public virtual void OnNodeVisible()
for (int i = 0; i < 8; i++)
{
ResizeNode node = Manager.ResizeNodes[i];
node.Shape = NodeShape.Square;
node.Visible = true;
}
}

View file

@ -174,7 +174,6 @@ public override void OnNodeVisible()
for (int i = 0; i < 8; i++)
{
ResizeNode node = Manager.ResizeNodes[i];
node.Shape = NodeShape.Circle;
node.Visible = false;
}

View file

@ -68,7 +68,6 @@ public override void OnNodeVisible()
base.OnNodeVisible();
TailNode.Position = TailPosition;
TailNode.Shape = NodeShape.Circle;
TailNode.Visible = true;
}

View file

@ -124,7 +124,6 @@ public override void Resize(int x, int y, bool fromBottomRight)
public override void OnNodeVisible()
{
Manager.ResizeNodes[(int)NodePosition.TopLeft].Shape = NodeShape.Circle;
Manager.ResizeNodes[(int)NodePosition.TopLeft].Visible = true;
}

View file

@ -248,6 +248,7 @@
<None Include="Resources\camera.png" />
<None Include="Resources\control.png" />
<None Include="Resources\cross.png" />
<None Include="Resources\CircleNode.png" />
<Content Include="Resources\Crosshair.cur" />
<None Include="Resources\exclamation-button.png" />
</ItemGroup>