資源簡介
可添加圖片,繪制網格,鼠標畫圖,并點擊鼠標或得點的坐標,以便計算點與點之間的距離。

代碼片段和文件信息
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;
namespace?菜單
{
????public?partial?class?Form1?:?Form
????{
????????public?bool?shouldPaint;
????????public?Point?startpt;
????????public?Point?endpt;
????????public?Graphics?g;
????????public?Pen?Mypen;
????????private?Image?curImage;
????????private?string?curFileName?=?null;
????????private?Rectangle?curRect;
????????private?Size?originalSize?=?new?Size(00);
????????private?double?curZoom?=?1.0;
????????public?Form1()
????????{
????????????InitializeComponent();
????????????bit?=?new?Bitmap(10?10);
????????????Graphics?g?=?Graphics.FromImage(bit);
????????????g.Clear(this.BackColor);
????????????g.DrawRectangle(Pens.Blue?new?Rectangle(0?0?10?10));
????????????g.Dispose();
????????????textureBrush?=?new?TextureBrush(bit);//使用TextureBrush可以有效減少窗體拉伸時的閃爍
????????}
????????TextureBrush?textureBrush;
????????Bitmap?bit;
????????int?x?=?0;
????????int?y?=?0;
????????bool?showRec?=?false;
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????g?=?this.CreateGraphics();
????????????Mypen?=?new?Pen(Color.Blue?3);
????????}
????????private?void?ExitMenu_Click(object?sender?EventArgs?e)
????????{
????????????this.Close();
????????}
????????private?void?openFileToolStripMenuItem_Click(object?sender?EventArgs?e)
????????{
????????????OpenFileDialog?opnDlg?=?new?OpenFileDialog();
????????????opnDlg.Filter?=?“All?Image?files|*.jpg;“;
????????????opnDlg.title?=?“ImageViewer:Open?Image?File“;
????????????opnDlg.ShowHelp?=?true;
????????????if?(opnDlg.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????curFileName?=?opnDlg.FileName;
????????????????try
????????????????{
????????????????????curImage?=?Image.FromFile(curFileName);
????????????????}
????????????????catch?(Exception?exp)
????????????????{
????????????????????MessageBox.Show(exp.Message);
????????????????}
????????????????this.AutoScroll?=?true;
????????????????this.AutoScrollMinSize?=?new?Size
????????????????((int)(curImage.Width)
????????????????(int)(curImage.Height));
????????????????this.Invalidate();
????????????}
???????????//?Invalidate();
????????????curRect?=?new?Rectangle(0?0?curImage.Width?curImage.Height);
????????????originalSize.Width?=?curImage.Width;
????????????originalSize.Height?=?curImage.Height;
????????}
????????private?void?Form1_Paint(object?sender?PaintEventArgs?e)
????????{
????????????e.Graphics.FillRectangle(textureBrush?this.ClientRectangle);
????????????if?(showRec)
????????????{
????????????????e.Graphics.DrawRectangle(Pens.Red?new?Rectangle(x?*?10?y?*?10?10?10));
????????????????Console.WriteLine(“xxx1“);
????????
????????????}
????????????Graphics?g?=?e.Graphics;
???????????//?Image?curImage?=?Image.FromFile(curFileName);
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????13824??2010-05-20?18:39??菜單\菜單\bin\Debug\菜單.exe
?????文件??????30208??2010-05-20?18:39??菜單\菜單\bin\Debug\菜單.pdb
?????文件??????14328??2010-05-20?18:39??菜單\菜單\bin\Debug\菜單.vshost.exe
?????文件????????490??2007-07-21?01:33??菜單\菜單\bin\Debug\菜單.vshost.exe.manifest
?????文件???????6096??2010-05-20?18:39??菜單\菜單\Form1.cs
?????文件???????9403??2010-05-20?18:39??菜單\菜單\Form1.Designer.cs
?????文件???????6012??2010-05-20?18:39??菜單\菜單\Form1.resx
?????文件???????1021??2010-05-20?18:44??菜單\菜單\obj\Debug\菜單.csproj.FileListAbsolute.txt
?????文件????????847??2010-05-20?18:39??菜單\菜單\obj\Debug\菜單.csproj.GenerateResource.Cache
?????文件??????13824??2010-05-20?18:39??菜單\菜單\obj\Debug\菜單.exe
?????文件????????180??2010-05-20?18:39??菜單\菜單\obj\Debug\菜單.Form1.resources
?????文件??????30208??2010-05-20?18:39??菜單\菜單\obj\Debug\菜單.pdb
?????文件????????180??2010-05-20?11:35??菜單\菜單\obj\Debug\菜單.Properties.Resources.resources
?????文件????????487??2010-05-18?19:39??菜單\菜單\Program.cs
?????文件???????1354??2010-05-18?19:39??菜單\菜單\Properties\AssemblyInfo.cs
?????文件???????2862??2010-05-18?19:39??菜單\菜單\Properties\Resources.Designer.cs
?????文件???????5612??2010-05-18?19:39??菜單\菜單\Properties\Resources.resx
?????文件???????1091??2010-05-18?19:39??菜單\菜單\Properties\Settings.Designer.cs
?????文件????????249??2010-05-18?19:39??菜單\菜單\Properties\Settings.settings
?????文件???????3758??2010-05-20?11:35??菜單\菜單\菜單.csproj
?????文件????????908??2010-05-18?19:39??菜單\菜單.sln
????..A..H.?????17408??2010-05-20?18:44??菜單\菜單.suo
?????目錄??????????0??2010-05-18?19:39??菜單\菜單\obj\Debug\TempPE
?????目錄??????????0??2010-05-18?20:14??菜單\菜單\bin\Debug
?????目錄??????????0??2010-05-20?18:39??菜單\菜單\obj\Debug
?????目錄??????????0??2010-05-18?19:39??菜單\菜單\bin
?????目錄??????????0??2010-05-18?19:39??菜單\菜單\obj
?????目錄??????????0??2010-05-18?19:39??菜單\菜單\Properties
?????目錄??????????0??2010-05-20?18:39??菜單\菜單
?????目錄??????????0??2010-05-18?19:39??菜單
............此處省略3個文件信息
- 上一篇:東北大學軟件學院編譯原理
- 下一篇:SSM框架搭建+后臺模板+登錄驗證
評論
共有 條評論