📄 form1.cs
字号:
/*
* ? SharpDevelop ???
* ??: Administrator
* ??: 2008-1-1 ???
* ??: 5:31
*
* ??????????,??????? | ?? | ?? | ???????
*/
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections;
using System.IO;
namespace MyTools
{
/// <summary>
/// Description of Form1.
/// </summary>
public partial class OpForm : Form
{
Hashtable hash;
public OpForm(ref Hashtable h)
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
hash = h;
}
void OpFormLoad(object sender, EventArgs e)
{
ListViewItem item = null;
foreach(string str in hash.Keys)
{
item = new ListViewItem();
item.SubItems[0].Text = str;
item.SubItems.Add((string)hash[str]);
listView1.Items.Add(item);
//MessageBox.Show(str);
}
item = null;
}
void Button1Click(object sender, EventArgs e)
{
//hash.Add(KeyBox.Text,PathBox.Text);
bool b = File.Exists(PathBox.Text);
if(b)
{
try
{
hash.Add(KeyBox.Text,PathBox.Text);
}
catch
{
MessageBox.Show("添加失败,请值是否重复");
return;
}
}
ListViewItem item = new ListViewItem();
item.SubItems[0].Text = KeyBox.Text;
item.SubItems.Add(PathBox.Text);
listView1.Items.Add(item);
MessageBox.Show("添加成功");
}
void ListView1SelectedIndexChanged(object sender, EventArgs e)
{
try
{
KeyBox.Text = listView1.SelectedItems[0].Text;
PathBox.Text = (string)hash[KeyBox.Text];
}
catch
{
}
}
void Button4Click(object sender, EventArgs e)
{
openFileDialog1.FileName = "";
openFileDialog1.Filter = "所有文件|*.*";
openFileDialog1.ShowDialog();
if(openFileDialog1.FileName == "")
return;
else
PathBox.Text = openFileDialog1.FileName;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -