资源简介
类似于微软自带的画图程序,用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.Drawing.Imaging;
namespace TestDrawing
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Color backColor = Color.White;
Image theImage;
string editName = string.Empty;
Graphics ig;
drawTools drawTool;
Color foreColor = Color.Black;
Point startPoint oldPoint;
bool isDrawing;
private void 新建ToolStripMenuItem_Click(object sender EventArgs e)
{
Graphics g = this.CreateGraphics();
g.Clear(backColor);
toolStrip1.Enabled = true;
theImage = new Bitmap(this.ClientRectangle.Width this.ClientRectangle.Height);
editName = “新建文件“;
this.Text = “MyDraw\t“ + editName;
ig = Graphics.FromImage(theImage);
ig.Clear(backColor);
}
private void 颜色ToolStripMenuItem_Click(object sender EventArgs e)
{
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
foreColor = this.colorDialog1.Color;
}
}
private void 打开ToolStripMenuItem_Click(object sender EventArgs e)
{
openFileDialog1.Multiselect = false;
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
editName = “打开文件“;
this.Text = “MyDraw\t“ + editName;
theImage = Image.FromFile(this.openFileDialog1.FileName);
Graphics g = this.CreateGraphics();
g.DrawImage(theImage this.ClientRectangle);
ig = Graphics.FromImage(theImage);
ig.DrawImage(theImage this.ClientRectangle);
this.toolStrip1.Enabled = true;
}
}
private void 保存ToolStripMenuItem_Click(object sender EventArgs e)
{
this.saveFileDialog1.Filter = “图像(*.bmp)|*.bmp“;
saveFileDialog1.FileName = editName;
if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
{
theImage.Save(this.saveFileDialog1.FileName ImageFormat.Bmp);
this.Text = “MyDraw\t“ + this.saveFileDialog1.FileName;
editName = this.saveFileDialog1.FileName;
}
}
private void Form1_Paint(object sender PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
if (theImage != null)
{
g.Clear(backColor);
g.DrawImage(theImage this.ClientRectangle);
}
}
private void Form1_MouseDown(object sender MouseEventArgs e)
{
if (e.Button == MouseB
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 22528 2012-06-08 17:01 TestDrawing\TestDrawing\bin\Debug\TestDrawing.exe
文件 36352 2012-06-08 17:01 TestDrawing\TestDrawing\bin\Debug\TestDrawing.pdb
文件 11600 2012-06-08 17:02 TestDrawing\TestDrawing\bin\Debug\TestDrawing.vshost.exe
文件 490 2010-03-17 22:39 TestDrawing\TestDrawing\bin\Debug\TestDrawing.vshost.exe.manifest
文件 7918 2012-06-08 17:02 TestDrawing\TestDrawing\Form1.cs
文件 12341 2012-06-08 16:59 TestDrawing\TestDrawing\Form1.Designer.cs
文件 13719 2012-06-08 16:59 TestDrawing\TestDrawing\Form1.resx
文件 2152 2012-06-08 15:41 TestDrawing\TestDrawing\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6332 2012-06-08 17:01 TestDrawing\TestDrawing\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 652 2012-06-08 17:01 TestDrawing\TestDrawing\obj\x86\Debug\GenerateResource.read.1.tlog
文件 2242 2012-06-08 17:01 TestDrawing\TestDrawing\obj\x86\Debug\GenerateResource.write.1.tlog
文件 1178 2012-06-08 17:02 TestDrawing\TestDrawing\obj\x86\Debug\TestDrawing.csproj.FileListAbsolute.txt
文件 22528 2012-06-08 17:01 TestDrawing\TestDrawing\obj\x86\Debug\TestDrawing.exe
文件 5366 2012-06-08 16:59 TestDrawing\TestDrawing\obj\x86\Debug\TestDrawing.Form1.resources
文件 36352 2012-06-08 17:01 TestDrawing\TestDrawing\obj\x86\Debug\TestDrawing.pdb
文件 180 2012-06-08 16:57 TestDrawing\TestDrawing\obj\x86\Debug\TestDrawing.Properties.Resources.resources
文件 180 2012-06-08 17:01 TestDrawing\TestDrawing\obj\x86\Debug\TestDrawing.TextForm.resources
文件 495 2012-06-08 15:41 TestDrawing\TestDrawing\Program.cs
文件 1358 2012-06-08 15:41 TestDrawing\TestDrawing\Properties\AssemblyInfo.cs
文件 2907 2012-06-08 15:41 TestDrawing\TestDrawing\Properties\Resources.Designer.cs
文件 5612 2012-06-08 15:41 TestDrawing\TestDrawing\Properties\Resources.resx
文件 1096 2012-06-08 15:41 TestDrawing\TestDrawing\Properties\Settings.Designer.cs
文件 249 2012-06-08 15:41 TestDrawing\TestDrawing\Properties\Settings.settings
文件 4000 2012-06-08 16:57 TestDrawing\TestDrawing\TestDrawing.csproj
文件 701 2012-06-08 17:01 TestDrawing\TestDrawing\TextForm.cs
文件 3240 2012-06-08 17:01 TestDrawing\TestDrawing\TextForm.Designer.cs
文件 5817 2012-06-08 17:01 TestDrawing\TestDrawing\TextForm.resx
文件 875 2012-06-08 15:41 TestDrawing\TestDrawing.sln
..A..H. 9728 2012-06-08 15:41 TestDrawing\TestDrawing.suo
目录 0 2012-06-08 15:41 TestDrawing\TestDrawing\obj\x86\Debug\TempPE
............此处省略11个文件信息
- 上一篇:在线答疑系统数据库文件
- 下一篇:asp.NET学生选课系统实验实验报告
相关资源
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
评论
共有 条评论