目录
form1.cs
namespace login_noteimage
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void login_Click(object sender, EventArgs e)
{
String name = Nametext.Text;
String pass = Passtext.Text;
if (name == "root" && pass == "123")
{
this.Hide();
Form2 f2 = new Form2();
f2.ShowDialog(this);
this.Hide();
this.Close();
}
else
{
MessageBox.Show("error!");
}
}
private void exit_Click(object sender, EventArgs e)
{
this.Hide();
this.Close();
Application.Exit();
}
private void check_Click(object sender, EventArgs e)
{
MessageBox.Show("root 123");
}
}
}
form2.cs
namespace login_noteimage
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void ji_button_Click(object sender, EventArgs e)
{
this.Hide();
Form3 f3 = new Form3();
f3.ShowDialog(this);
this.Close();
}
private void shu_button_Click(object sender, EventArgs e)
{
this.Hide();
Form4 f4 = new Form4();
f4.ShowDialog(this);
this.Close();
}
private void tu_button_Click(object sender, EventArgs e)
{
this.Hide();
Form5 f5 = new Form5();
f5.ShowDialog(this);
this.Close();
}
private void tui_button_Click(object sender, EventArgs e)
{
this.Close();
Application.Exit();
}
}
}
form3.cs
namespace login_noteimage
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void jian_btn_Click(object sender, EventArgs e)
{
textbox.Cut();
}
private void fu_btn_Click(object sender, EventArgs e)
{
textbox.Copy();
}
private void zhan_btn_Click(object sender, EventArgs e)
{
textbox.Paste();
}
private void zi_btn_Click(object sender, EventArgs e)
{
fontDialog1.ShowDialog();//显示对话框
textbox.Font = fontDialog1.Font;//赋值字体
}
private void fan_btn_Click(object sender, EventArgs e)
{
this.Hide();
Form2 f2 = new Form2();
f2.ShowDialog(this);
this.Close();
}
}
}
form4.cs
namespace login_noteimage
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
shi_com.Items.Add("2");//选择项1
shi_com.Items.Add("8");
shi_com.Items.Add("10");
shi_com.Items.Add("16");
shi_com.SelectedIndex = shi_com.Items.IndexOf("16");
bian_com.Items.Add("2");//选择项1
bian_com.Items.Add("8");
bian_com.Items.Add("10");
bian_com.Items.Add("16");
bian_com.SelectedIndex = bian_com.Items.IndexOf("16");
}
private void label1_Click(object sender, EventArgs e)
{
}
private void fan_btn_Click(object sender, EventArgs e)
{
this.Hide();
Form2 f2 = new Form2();
f2.ShowDialog(this);
this.Close();
}
private void start_btn_Click(object sender, EventArgs e)
{
String num = Input_text.Text;
String shi = shi_com.Text;
String bian = bian_com.Text;
if (num == null)
{
MessageBox.Show("要填数字!");
}
int c=0;
if (shi == "2")
{
const string PATTERN1 = @"[0-1]+$";
if (!System.Text.RegularExpressions.Regex.IsMatch(num, PATTERN1))
{
MessageBox.Show("所输入数字进制错");
this.Refresh();
}
int d = Convert.ToInt32(num, 2);//2->10
if (bian == "10") c = d;
else if (bian == "8")
{
string s12 = Convert.ToString(d, 8);//10->8
c = int.Parse(s12);
}
else
{
string s12 = Convert.ToString(d, 16);//10->16
c = int.Parse(s12);
}
}
else if (shi == "8")
{
const string PATTERN2 = @"[0-7]+$";
if (!System.Text.RegularExpressions.Regex.IsMatch(num, PATTERN2))
{
MessageBox.Show("所输入数字进制错");
this.Refresh();
}
int d = Convert.ToInt32(num, 8);//8->10
if (bian == "10") c = d;
else if (bian == "2")
{
string s12 = Convert.ToString(d, 2);//10->2
c = int.Parse(s12);
}
else
{
string s12 = Convert.ToString(d, 16);//10->16
c = int.Parse(s12);
}
}
else if (shi == "10")
{
const string PATTERN3 = @"[0-9]+$";
if (!System.Text.RegularExpressions.Regex.IsMatch(num, PATTERN3))
{
MessageBox.Show("所输入数字进制错");
this.Refresh();
}
int d = int.Parse(num);
if (bian == "2")
{
string s12 = Convert.ToString(d, 2);//10->2
c = int.Parse(s12);
}
else if (bian == "8")
{
string s12 = Convert.ToString(d, 8);//10->8
c = int.Parse(s12);
}
else
{
string s12 = Convert.ToString(d, 16);//10->16
c = int.Parse(s12);
}
}
else
{
const string PATTERN = @"[A-Fa-f0-9]+$";
if (!System.Text.RegularExpressions.Regex.IsMatch(num, PATTERN))
{
MessageBox.Show("所输入数字进制错");
this.Refresh();
}
int d = Convert.ToInt32(num, 16);//16->10
if (bian == "10") c = d;
else if (bian == "8")
{
string s12 = Convert.ToString(d, 8);//10->8
c = int.Parse(s12);
}
else
{
string s12 = Convert.ToString(d, 2);//10->2
c = int.Parse(s12);
}
}
jie_text.Text =c.ToString() ;
}
private void shi_com_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void bian_com_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void clear_btn_Click(object sender, EventArgs e)
{
Input_text.Text = "";
jie_text.Text = "";
}
}
}
form5.cs
namespace login_noteimage
{
public partial class Form5 : Form
{
int count = 0;//照片总数
int tep = 0;
int cur = 0;
OpenFileDialog openFileDialog3 = new OpenFileDialog();
int Width = 0;
int Height=0;
public Form5()
{
InitializeComponent();
openFileDialog3.Multiselect = true;//可以多选
openFileDialog3.Filter = "PNG(*.png)|*.png|JPG(*.jpg)|*.jpg|BMP(*.bmp)|*.bmp";
imageList1.ImageSize = new Size(256, 256);
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
this.Width = pictureBox1.Size.Width;
this.Height = pictureBox1.Size.Height;
bili_text.Text = this.Width.ToString() + " "+this.Height.ToString();
this.pictureBox1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseWheel);
}
private void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
{
if (e.Delta > 0)
{
pictureBox1.Width += 10;
pictureBox1.Height += 10;
}
else
{
pictureBox1.Width -= 10;
pictureBox1.Height -= 10;
}
bili_text.Text = pictureBox1.Width.ToString() + " " + pictureBox1.Height.ToString();
}
private void fan_btn_Click(object sender, EventArgs e)
{
this.Hide();
Form2 f2 = new Form2();
f2.ShowDialog(this);
this.Close();
}
private void xuan_btn_Click(object sender, EventArgs e)
{
try
{
openFileDialog3.ShowDialog();//在本地选图片
string[] st = openFileDialog3.FileNames;
pictureBox1.Image = Image.FromFile(openFileDialog3.FileName);
}catch(Exception e3)
{
return;
}
count = openFileDialog3.FileNames.Length;
for(int j = 0; j < count; j++)
{
imageList1.Images.Add(Image.FromFile(openFileDialog3.FileNames[j]));//加入图片库
}
zong_text.Text = count.ToString();
}
private void first_btn_Click(object sender, EventArgs e)
{
pictureBox1.Image = Image.FromFile(openFileDialog3.FileNames[0]);
cur = 0;
xian_text.Text = cur.ToString();
}
private void last_btn_Click(object sender, EventArgs e)
{
pictureBox1.Image = Image.FromFile(openFileDialog3.FileNames[count-1]);
cur = count-1;
xian_text.Text = cur.ToString();
}
private void shang_btn_Click(object sender, EventArgs e)
{
// MessageBox.Show(this.cur.ToString());
this.cur--;
if (cur < 0) cur = count - 1;
pictureBox1.Image = Image.FromFile(openFileDialog3.FileNames[cur]);
xian_text.Text = cur.ToString();
}
private void xia_btn_Click(object sender, EventArgs e)
{
this.cur++;
if (cur >= count) cur = 0;
pictureBox1.Image = Image.FromFile(openFileDialog3.FileNames[cur]);
xian_text.Text = cur.ToString();
}
private void zong_text_TextChanged(object sender, EventArgs e)
{
}
private void xian_text_TextChanged(object sender, EventArgs e)
{
}
private void fang_btn_Click(object sender, EventArgs e)
{
}
private void suo_btn_Click(object sender, EventArgs e)
{
}
private void ping_btn_Click(object sender, EventArgs e)
{
pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
}
private void zhong_btn_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
}
}