📄 photo.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Data.SqlClient;
using System.IO;
namespace BlueHill_Win_
{
public partial class Photo : Form
{
public static byte[] image;
public Photo()
{
InitializeComponent();
}
public static string txt;
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button1_Click(object sender, EventArgs e)
{
string filename;
openFileDialog1.InitialDirectory = "c:\\" ;
this.openFileDialog1.Filter = "图片文件(*.jpg;*.gif;*.bmp)|*.jpg;*.gif;*.bmp";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
filename = this.openFileDialog1.FileName;
this.pictureBox2.Image = Image.FromFile(this.openFileDialog1.FileName, true);
try
{
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
byte[] bt = new byte[fs.Length];
fs.Read(bt, 0, bt.Length);
fs.Close();
image = bt;
//txt = openFileDialog1.FilterIndex.ToString();
//txt = textBox1.Text.Trim();
textBox1.Text = openFileDialog1.FileName.ToString();
}
catch (Exception oe)
{
MessageBox.Show(oe.Message.ToString());
}
}
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim()!="")
{
txt = textBox1.Text;
this.Close();
}
else
DialogResult = MessageBox.Show("请指定照片路径!", "提示");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -