close
開啟新的空白方案,輸入關鍵字: 空白
建ˋ不含專案的空白方案
加入menuStrip
using Emgu.CV;
using Emgu.CV.Structure;
namespace LoadImageDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
using(OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = "jpg file (*.jpg)|*.jpg|All files(*.*)|*.*";
if(ofd.ShowDialog() == DialogResult.OK)
{
Emgu.CV.Image<Bgr, byte> img = new Emgu.CV.Image<Bgr, byte>(ofd.FileName);
pictureBox1.Image = img.ToBitmap();
}
}
}
private void normalToolStripMenuItem_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
}
private void stretchToolStripMenuItem_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
}
private void autoSizeToolStripMenuItem_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
}
private void centerImageToolStripMenuItem_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
private void zoomToolStripMenuItem_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
}
}
Normal mode
Stretch mode
Autosize mode
CenterImage mode
Zoom mode
全站熱搜
留言列表