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

@@ -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);
}
}