248 lines
9.7 KiB
C#
248 lines
9.7 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Windows.Forms;
|
|||
|
using RyzStudio.Windows.ThemedForms;
|
|||
|
|
|||
|
namespace RandomFileRunner
|
|||
|
{
|
|||
|
public class MemoBoxForm : Form
|
|||
|
{
|
|||
|
private ThButton button1;
|
|||
|
private ThMemoBox memoBox1;
|
|||
|
private ThButton button3;
|
|||
|
private ThButton button4;
|
|||
|
private ContextMenuStrip contextMenuStrip1;
|
|||
|
private System.ComponentModel.IContainer components;
|
|||
|
private ToolStripMenuItem addDirectoryToolStripMenuItem;
|
|||
|
private ToolStripMenuItem addFileToolStripMenuItem;
|
|||
|
private FolderBrowserDialog folderBrowserDialog1;
|
|||
|
private OpenFileDialog openFileDialog1;
|
|||
|
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
|
|||
|
|
|||
|
|
|||
|
public MemoBoxForm() : base()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
|
|||
|
memoBox1.TextBox.WordWrap = false;
|
|||
|
}
|
|||
|
|
|||
|
private void InitializeComponent()
|
|||
|
{
|
|||
|
components = new System.ComponentModel.Container();
|
|||
|
button1 = new ThButton();
|
|||
|
tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
|||
|
memoBox1 = new ThMemoBox();
|
|||
|
button3 = new ThButton();
|
|||
|
contextMenuStrip1 = new ContextMenuStrip(components);
|
|||
|
addDirectoryToolStripMenuItem = new ToolStripMenuItem();
|
|||
|
addFileToolStripMenuItem = new ToolStripMenuItem();
|
|||
|
button4 = new ThButton();
|
|||
|
folderBrowserDialog1 = new FolderBrowserDialog();
|
|||
|
openFileDialog1 = new OpenFileDialog();
|
|||
|
contextMenuStrip1.SuspendLayout();
|
|||
|
SuspendLayout();
|
|||
|
//
|
|||
|
// button1
|
|||
|
//
|
|||
|
button1.AcceptButton = null;
|
|||
|
button1.ActiveImage = null;
|
|||
|
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|||
|
button1.BackColor = System.Drawing.Color.Transparent;
|
|||
|
button1.EnableMenuOnClick = false;
|
|||
|
button1.EnableReactiveVisual = true;
|
|||
|
button1.HoverImage = null;
|
|||
|
button1.IdleImage = null;
|
|||
|
button1.LabelText = "&Save";
|
|||
|
button1.Location = new System.Drawing.Point(241, 469);
|
|||
|
button1.Margin = new Padding(10, 0, 10, 10);
|
|||
|
button1.Name = "button1";
|
|||
|
button1.Padding = new Padding(4, 4, 3, 3);
|
|||
|
button1.Size = new System.Drawing.Size(128, 32);
|
|||
|
button1.TabIndex = 4;
|
|||
|
button1.TabStop = false;
|
|||
|
button1.MouseClick += button1_MouseClick;
|
|||
|
//
|
|||
|
// tHorizontalSeparator1
|
|||
|
//
|
|||
|
tHorizontalSeparator1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|||
|
tHorizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
|||
|
tHorizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
|||
|
tHorizontalSeparator1.BackColor = System.Drawing.Color.Transparent;
|
|||
|
tHorizontalSeparator1.Location = new System.Drawing.Point(10, 437);
|
|||
|
tHorizontalSeparator1.Margin = new Padding(0, 10, 0, 0);
|
|||
|
tHorizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
|
|||
|
tHorizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22);
|
|||
|
tHorizontalSeparator1.Name = "tHorizontalSeparator1";
|
|||
|
tHorizontalSeparator1.Size = new System.Drawing.Size(364, 22);
|
|||
|
tHorizontalSeparator1.TabIndex = 188;
|
|||
|
tHorizontalSeparator1.TabStop = false;
|
|||
|
//
|
|||
|
// memoBox1
|
|||
|
//
|
|||
|
memoBox1.AcceptButton = null;
|
|||
|
memoBox1.AllowDrop = true;
|
|||
|
memoBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|||
|
memoBox1.BackColor = System.Drawing.Color.Transparent;
|
|||
|
memoBox1.EnableReactiveVisual = true;
|
|||
|
memoBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
|
|||
|
memoBox1.Location = new System.Drawing.Point(10, 70);
|
|||
|
memoBox1.Margin = new Padding(10, 6, 10, 6);
|
|||
|
memoBox1.Name = "memoBox1";
|
|||
|
memoBox1.Padding = new Padding(4, 4, 3, 3);
|
|||
|
memoBox1.ReadOnly = false;
|
|||
|
memoBox1.ScrollBars = ScrollBars.Vertical;
|
|||
|
memoBox1.Size = new System.Drawing.Size(364, 361);
|
|||
|
memoBox1.TabIndex = 191;
|
|||
|
memoBox1.TabStop = false;
|
|||
|
memoBox1.WordWrap = false;
|
|||
|
//
|
|||
|
// button3
|
|||
|
//
|
|||
|
button3.AcceptButton = null;
|
|||
|
button3.ActiveImage = null;
|
|||
|
button3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|||
|
button3.BackColor = System.Drawing.Color.Transparent;
|
|||
|
button3.ContextMenuStrip = contextMenuStrip1;
|
|||
|
button3.EnableMenuOnClick = true;
|
|||
|
button3.EnableReactiveVisual = true;
|
|||
|
button3.HoverImage = null;
|
|||
|
button3.IdleImage = null;
|
|||
|
button3.LabelText = "&Add";
|
|||
|
button3.Location = new System.Drawing.Point(10, 21);
|
|||
|
button3.Margin = new Padding(10, 0, 10, 10);
|
|||
|
button3.Name = "button3";
|
|||
|
button3.Padding = new Padding(4, 4, 3, 3);
|
|||
|
button3.Size = new System.Drawing.Size(177, 33);
|
|||
|
button3.TabIndex = 189;
|
|||
|
button3.TabStop = false;
|
|||
|
//
|
|||
|
// contextMenuStrip1
|
|||
|
//
|
|||
|
contextMenuStrip1.Items.AddRange(new ToolStripItem[] { addDirectoryToolStripMenuItem, addFileToolStripMenuItem });
|
|||
|
contextMenuStrip1.Name = "contextMenuStrip1";
|
|||
|
contextMenuStrip1.Size = new System.Drawing.Size(148, 48);
|
|||
|
//
|
|||
|
// addDirectoryToolStripMenuItem
|
|||
|
//
|
|||
|
addDirectoryToolStripMenuItem.Name = "addDirectoryToolStripMenuItem";
|
|||
|
addDirectoryToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
|
|||
|
addDirectoryToolStripMenuItem.Text = "&Add Directory";
|
|||
|
addDirectoryToolStripMenuItem.Click += addDirectoryToolStripMenuItem_Click;
|
|||
|
//
|
|||
|
// addFileToolStripMenuItem
|
|||
|
//
|
|||
|
addFileToolStripMenuItem.Name = "addFileToolStripMenuItem";
|
|||
|
addFileToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
|
|||
|
addFileToolStripMenuItem.Text = "Add &File";
|
|||
|
addFileToolStripMenuItem.Click += addFileToolStripMenuItem_Click;
|
|||
|
//
|
|||
|
// button4
|
|||
|
//
|
|||
|
button4.AcceptButton = null;
|
|||
|
button4.ActiveImage = null;
|
|||
|
button4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|||
|
button4.BackColor = System.Drawing.Color.Transparent;
|
|||
|
button4.EnableMenuOnClick = false;
|
|||
|
button4.EnableReactiveVisual = true;
|
|||
|
button4.HoverImage = null;
|
|||
|
button4.IdleImage = null;
|
|||
|
button4.LabelText = "&Clear";
|
|||
|
button4.Location = new System.Drawing.Point(197, 21);
|
|||
|
button4.Margin = new Padding(10, 0, 10, 10);
|
|||
|
button4.Name = "button4";
|
|||
|
button4.Padding = new Padding(4, 4, 3, 3);
|
|||
|
button4.Size = new System.Drawing.Size(177, 33);
|
|||
|
button4.TabIndex = 190;
|
|||
|
button4.TabStop = false;
|
|||
|
button4.MouseClick += button4_MouseClick;
|
|||
|
//
|
|||
|
// folderBrowserDialog1
|
|||
|
//
|
|||
|
folderBrowserDialog1.ShowNewFolderButton = false;
|
|||
|
//
|
|||
|
// openFileDialog1
|
|||
|
//
|
|||
|
openFileDialog1.Filter = "All files (*.*)|*.*";
|
|||
|
//
|
|||
|
// MemoBoxForm
|
|||
|
//
|
|||
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|||
|
AutoScaleMode = AutoScaleMode.Font;
|
|||
|
ClientSize = new System.Drawing.Size(384, 521);
|
|||
|
Controls.Add(memoBox1);
|
|||
|
Controls.Add(button3);
|
|||
|
Controls.Add(button4);
|
|||
|
Controls.Add(tHorizontalSeparator1);
|
|||
|
Controls.Add(button1);
|
|||
|
MinimumSize = new System.Drawing.Size(400, 560);
|
|||
|
Name = "MemoBoxForm";
|
|||
|
ShowIcon = false;
|
|||
|
ShowInTaskbar = false;
|
|||
|
Text = "Manage Search Paths";
|
|||
|
contextMenuStrip1.ResumeLayout(false);
|
|||
|
ResumeLayout(false);
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnShown(EventArgs e)
|
|||
|
{
|
|||
|
base.OnShown(e);
|
|||
|
|
|||
|
this.DialogResult = System.Windows.Forms.DialogResult.None;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public List<string> Lines
|
|||
|
{
|
|||
|
get => memoBox1.Lines;
|
|||
|
set
|
|||
|
{
|
|||
|
memoBox1.TextBox.Lines = value.ToArray();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void button1_MouseClick(object sender, MouseEventArgs e)
|
|||
|
{
|
|||
|
this.DialogResult = DialogResult.OK;
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Add Directory.
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void addDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
|
|||
|
{
|
|||
|
memoBox1.TextBox.AddLine(folderBrowserDialog1.SelectedPath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Add File.
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
|||
|
{
|
|||
|
memoBox1.TextBox.AddLine(openFileDialog1.FileName);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Clear.
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
private void button4_MouseClick(object sender, MouseEventArgs e)
|
|||
|
{
|
|||
|
memoBox1.Text = string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|