mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Don't save text inside options
This commit is contained in:
parent
e0dc853c6f
commit
c52eb0cdc8
4 changed files with 13 additions and 10 deletions
|
@ -303,7 +303,7 @@ private void InitializeComponent()
|
|||
this.Name = "TextDrawingInputBox";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "ShareX - Text input";
|
||||
this.InputText = "ShareX - Text input";
|
||||
this.TopMost = true;
|
||||
this.flpProperties.ResumeLayout(false);
|
||||
this.flpProperties.PerformLayout();
|
||||
|
|
|
@ -38,18 +38,20 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
internal partial class TextDrawingInputBox : Form
|
||||
{
|
||||
public string InputText { get; private set; }
|
||||
public TextDrawingOptions Options { get; private set; }
|
||||
|
||||
public TextDrawingInputBox(TextDrawingOptions options)
|
||||
public TextDrawingInputBox(string text, TextDrawingOptions options)
|
||||
{
|
||||
InitializeComponent();
|
||||
Icon = ShareXResources.Icon;
|
||||
|
||||
InputText = text;
|
||||
Options = options;
|
||||
|
||||
if (Options.Text != null)
|
||||
if (InputText != null)
|
||||
{
|
||||
txtInput.Text = Options.Text;
|
||||
txtInput.Text = InputText;
|
||||
}
|
||||
|
||||
UpdateInputBox();
|
||||
|
@ -162,7 +164,7 @@ private void tsmiAlignmentBottom_Click(object sender, EventArgs e)
|
|||
|
||||
private void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Options.Text = txtInput.Text;
|
||||
InputText = txtInput.Text;
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -33,7 +33,6 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public class TextDrawingOptions
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public string Font { get; set; } = "Arial";
|
||||
public int Size { get; set; } = 18;
|
||||
public Color Color { get; set; } = Color.Black;
|
||||
|
|
|
@ -39,13 +39,14 @@ public class TextDrawingShape : BaseDrawingShape
|
|||
{
|
||||
public override ShapeType ShapeType { get; } = ShapeType.DrawingText;
|
||||
|
||||
public string Text { get; set; }
|
||||
public TextDrawingOptions Options { get; set; } = new TextDrawingOptions();
|
||||
|
||||
public override void Draw(Graphics g)
|
||||
{
|
||||
base.Draw(g);
|
||||
|
||||
if (!string.IsNullOrEmpty(Options.Text))
|
||||
if (!string.IsNullOrEmpty(Text))
|
||||
{
|
||||
DrawText(g);
|
||||
}
|
||||
|
@ -53,7 +54,7 @@ public override void Draw(Graphics g)
|
|||
|
||||
public override void DrawFinal(Graphics g, Bitmap bmp)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Options.Text))
|
||||
if (!string.IsNullOrEmpty(Text))
|
||||
{
|
||||
DrawText(g);
|
||||
}
|
||||
|
@ -66,7 +67,7 @@ private void DrawText(Graphics g)
|
|||
{
|
||||
using (Brush textBrush = new SolidBrush(Options.Color))
|
||||
{
|
||||
g.DrawString(Options.Text, font, textBrush, Rectangle, sf);
|
||||
g.DrawString(Text, font, textBrush, Rectangle, sf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,9 +76,10 @@ private void UpdateText()
|
|||
{
|
||||
Manager.PauseForm();
|
||||
|
||||
using (TextDrawingInputBox inputBox = new TextDrawingInputBox(Options))
|
||||
using (TextDrawingInputBox inputBox = new TextDrawingInputBox(Text, Options))
|
||||
{
|
||||
inputBox.ShowDialog();
|
||||
Text = inputBox.InputText;
|
||||
}
|
||||
|
||||
Manager.ResumeForm();
|
||||
|
|
Loading…
Reference in a new issue