资源简介
这是我做的一个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;
namespace Paint
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
bool allowMouseMove = false;
bool allowPaint = false;
Point startPoint;
Point endPoint;
Graphics g;
private void Form1_Load(object sender EventArgs e)
{
g = this.CreateGraphics();
}
private void 画椭圆ToolStripMenuItem_Click(object sender EventArgs e)
{
allowMouseMove = true;
}
private void Form1_MouseDown(object sender MouseEventArgs e)
{
allowPaint = true;
startPoint = new Point(e.Xe.Y);
}
private void Form1_MouseMove(object sender MouseEventArgs e)
{
if (allowMouseMove)
{
endPoint=new Point(e.Xe.Y);
if (allowPaint)
{
this.Refresh();
g.DrawEllipse(new Pen(Color.Black1)startPoint.XstartPoint.YendPoint.X-startPoint.XendPoint.Y-startPoint.Y);
}
}
}
private void Form1_MouseUp(object sender MouseEventArgs e)
{
allowPaint = false;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9216 2012-04-10 22:33 MousePaint\Paint\Paint\bin\Debug\Paint.exe
文件 24064 2012-04-10 22:33 MousePaint\Paint\Paint\bin\Debug\Paint.pdb
文件 11600 2012-04-10 22:33 MousePaint\Paint\Paint\bin\Debug\Paint.vshost.exe
文件 490 2010-03-17 22:39 MousePaint\Paint\Paint\bin\Debug\Paint.vshost.exe.manifest
文件 1523 2012-04-10 22:33 MousePaint\Paint\Paint\Form1.cs
文件 3254 2012-04-10 22:28 MousePaint\Paint\Paint\Form1.Designer.cs
文件 6015 2012-04-10 22:28 MousePaint\Paint\Paint\Form1.resx
文件 2152 2012-04-10 22:24 MousePaint\Paint\Paint\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6196 2012-04-10 22:33 MousePaint\Paint\Paint\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 184 2012-04-10 22:32 MousePaint\Paint\Paint\obj\x86\Debug\GenerateResource.read.1.tlog
文件 458 2012-04-10 22:32 MousePaint\Paint\Paint\obj\x86\Debug\GenerateResource.write.1.tlog
文件 613 2012-04-10 22:33 MousePaint\Paint\Paint\obj\x86\Debug\Paint.csproj.FileListAbsolute.txt
文件 9216 2012-04-10 22:33 MousePaint\Paint\Paint\obj\x86\Debug\Paint.exe
文件 180 2012-04-10 22:32 MousePaint\Paint\Paint\obj\x86\Debug\Paint.Form1.resources
文件 24064 2012-04-10 22:33 MousePaint\Paint\Paint\obj\x86\Debug\Paint.pdb
文件 180 2012-04-10 22:32 MousePaint\Paint\Paint\obj\x86\Debug\Paint.Properties.Resources.resources
文件 3669 2012-04-10 22:25 MousePaint\Paint\Paint\Paint.csproj
文件 497 2012-04-10 22:24 MousePaint\Paint\Paint\Program.cs
文件 1440 2012-04-10 22:24 MousePaint\Paint\Paint\Properties\AssemblyInfo.cs
文件 2838 2012-04-10 22:24 MousePaint\Paint\Paint\Properties\Resources.Designer.cs
文件 5612 2012-04-10 22:24 MousePaint\Paint\Paint\Properties\Resources.resx
文件 1090 2012-04-10 22:24 MousePaint\Paint\Paint\Properties\Settings.Designer.cs
文件 249 2012-04-10 22:24 MousePaint\Paint\Paint\Properties\Settings.settings
文件 857 2012-04-10 22:24 MousePaint\Paint\Paint.sln
..A..H. 26112 2012-04-10 22:33 MousePaint\Paint\Paint.suo
文件 10240 2012-04-10 22:47 MousePaint\Paint and Save\Paint\bin\Debug\Paint.exe
文件 34304 2012-04-10 22:47 MousePaint\Paint and Save\Paint\bin\Debug\Paint.pdb
文件 11600 2012-04-10 22:47 MousePaint\Paint and Save\Paint\bin\Debug\Paint.vshost.exe
文件 490 2010-03-17 22:39 MousePaint\Paint and Save\Paint\bin\Debug\Paint.vshost.exe.manifest
文件 528 2012-04-10 22:42 MousePaint\Paint and Save\Paint\ellipse.cs
............此处省略43个文件信息
相关资源
- 明华URF-35H读卡器 C#读写源码 为大家
- c# GDI+画图用鼠标绘制直线、矩形、椭
- winform图片标尺,画矩形
- 用C#开发与Domino交互的应用原创
- 原创WPF卫生相关文档编辑器
- (原创)C#控制台扫雷小游戏源码
- C#调用matlab画图,解决图像嵌入Winfo
- asp.net网上商城系统原创数据库课程设
- 极品工控控件 C# 非常有用
- ASP.NET三层架构小说网期末答辩项目原
- C#课程设计一个自己做的收银系统火锅
- 超全的C# GDI+画图板
- C# Winform画图板
- C#库存管理系统数据库+源代码+报告原
- C#绘制动态曲线通过控件的Paint事件,
- C#黑白棋完整版-开发者-沙加原创
- [原创]实现用C#开发K3插件教程
- asp.net商城网站源码原创
- wpf 图片滑动效果
- 原创仿OpenFileDialog文件选择对话框源码
- vb.net画图chat的经典实用案例
- wpf高性能画图
- c#课程设计 画图
- VB.NET C# 截屏小工具
- c# 文件全盘搜索 多线程 vs2005 winform
- 用c#实现画图功能可以画出各种图形,
- 生产者消费者为模型的多线程编程c
- C# 实现画图软件
- C#画图软件-源程序代码
- C#开发cad画图软件 GDI+
评论
共有 条评论