removed the border around the text box and fixed the "Open With" function

This commit is contained in:
Brendan
2024-05-31 22:32:59 +02:00
parent e16091be31
commit 4c52a98373
6 changed files with 57 additions and 17 deletions

View File

@@ -34,7 +34,7 @@
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(63, 39);
this.label1.TabIndex = 0;
this.label1.Text = "V_EditorPro\nVersion 1.0\nOS: ";
this.label1.Text = "V_EditorPro\nVersion 1.1\nOS: ";
//
// pictureBox1
//

View File

@@ -12,7 +12,7 @@ namespace V_EditorPro
{
InitializeComponent();
label1.Text = $"V_EditorPro\nVersion 1.0\nOS: {RuntimeInformation.OSDescription}";
label1.Text = $"V_EditorPro\nVersion 1.1\nOS: {RuntimeInformation.OSDescription}";
}
private void pictureBox1_Click(object sender, EventArgs e)

View File

@@ -8,13 +8,19 @@ namespace V_EditorPro
{
public partial class MainForm : Form
{
public MainForm()
public MainForm(string filePath = null)
{
InitializeComponent();
this.KeyPreview = true;
this.KeyDown += new KeyEventHandler(MainForm_KeyDown);
if (!string.IsNullOrEmpty(filePath))
{
OpenFile(filePath);
}
}
private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.O)
@@ -53,6 +59,11 @@ namespace V_EditorPro
}
}
private void OpenFile(string filePath)
{
richTextBox1.Text = File.ReadAllText(filePath);
}
private void OpenFile()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
@@ -60,7 +71,7 @@ namespace V_EditorPro
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
richTextBox1.Text = File.ReadAllText(openFileDialog.FileName);
OpenFile(openFileDialog.FileName);
}
}

View File

@@ -13,11 +13,24 @@ namespace V_EditorPro
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
if (args.Length > 0)
{
// A file was passed as an argument
string filePath = args[0];
// Create the main form and pass the file path to it
Application.Run(new MainForm(filePath));
}
else
{
// No file was passed as an argument
Application.Run(new MainForm());
}
}
}
}
}

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0")]
[assembly: AssemblyFileVersion("1.0")]
[assembly: AssemblyVersion("1.1")]
[assembly: AssemblyFileVersion("1.1")]