[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.InitialDirectory = "c:\\";
open.Filter = "图片文件(jpg,jpeg,bmp,gif,ico,pen,tif)|*.jpg;*.jpeg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf";
if (open.ShowDialog()== DialogResult.OK)
{
pictureBox1.ImageLocation = open.FileName;
}
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void 居中ToolStripMenuItem_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
private void 正常ToolStripMenuItem_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
private void 说明ToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("右击也可以使用功能","信息框",MessageBoxButtons.OK,MessageBoxIcon.None);
}
private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e) //这里的另存为代码怎么写,能够保存在硬盘里或者桌面上?
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
string i = saveFileDialog1.FileName;
}
}
}
}
|