资源简介
C#鼠标画多边形和矩形 C#实现类画图软件功能,可以用鼠标在界面上画多边形 矩形 圆形 或者充当画笔画任意形状
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace DrawDesigns
{
public partial class Form1 : Form
{
Boolean mouseDown = false; //鼠标左键是否按下
String drawShape = “Line“; //椭什么形状,初始为线
Point StartPoint = Point.Empty EndPoint = Point.Empty; //鼠标移动的起始点
Color color = Color.Black; //定义图像边框颜色
ArrayList appendList = new ArrayList(); //图形属性列表
Cursor LineCursor CurveCursor EraserCursor; //鼠标样式
public Form1()
{
InitializeComponent();
}
//移动
private void MoveButton_Click(object sender EventArgs e)
{
this.Canvas.Cursor = Cursors.Default;
this.drawShape = ““;
}
//直线
private void DrawLine_Click(object sender EventArgs e)
{
LineCursor = new Cursor(“./MouseIcon/Pen.ico“);
this.drawShape = “Line“;
this.Canvas.Cursor = LineCursor;
}
//曲线
private void DrawCurve_Click(object sender EventArgs e)
{
CurveCursor = new Cursor(“./MouseIcon/Curve.ico“);
this.drawShape = “Curve“;
this.Canvas.Cursor = CurveCursor;
}
//椭圆
private void DrawEllipse_Click(object sender EventArgs e)
{
this.drawShape = “Ellipse“;
this.Canvas.Cursor = Cursors.Cross;
}
//矩形
private void DrawRectangle_Click(object sender EventArgs e)
{
this.drawShape = “Rectangle“;
this.Canvas.Cursor = Cursors.Cross;
}
//擦除
private void EraserTool_Click(object sender EventArgs e)
{
EraserCursor = new Cursor(“./MouseIcon/Eraser.ico“);
this.drawShape = “Eraser“;
this.Canvas.Cursor = EraserCursor;
}
///
/// 图形属性列表
///
public struct ShapeType
{
public string type;
public Point StartPoint EndPoint;
public Color foreColor backColor;
public Brush brush;
public ShapeType(string type Point StartPoint Point EndPoint Color foreColor Color backColor Brush brush)
{
this.type = type;
this.StartPoint = StartPoint;
this.EndPoint = EndPoint;
this.foreColor = foreColor;
this.backColor = backColor;
this.brush = brush;
}
}
//鼠标按下事件
private void Canvas_MouseDown(object sender MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.StartPoint = ne
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4258 2010-11-15 14:50 C#DrawDesign\Backup\DrawDesigns\DrawDesigns.csproj
文件 15596 2010-11-15 14:59 C#DrawDesign\Backup\DrawDesigns\Form1.cs
文件 15148 2010-11-15 14:59 C#DrawDesign\Backup\DrawDesigns\Form1.designer.cs
文件 9871 2010-11-15 14:59 C#DrawDesign\Backup\DrawDesigns\Form1.resx
文件 2238 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\ICO\Clear.ico
文件 2238 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\ICO\Curve.ico
文件 4710 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\ICO\Eraser.ico
文件 2238 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\ICO\Icon.ico
文件 3638 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\ICO\Pen.ico
文件 2238 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\Icon.ico
文件 2374 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\Image\CircleShape.png
文件 8097 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\Image\color.jpg
文件 3819 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\Image\cursor.png
文件 3289 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\Image\Rectangle.png
文件 492 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns\Program.cs
文件 1451 2010-11-15 15:01 C#DrawDesign\Backup\DrawDesigns\Properties\AssemblyInfo.cs
文件 4609 2010-11-15 14:56 C#DrawDesign\Backup\DrawDesigns\Properties\Resources.Designer.cs
文件 7621 2010-11-15 14:56 C#DrawDesign\Backup\DrawDesigns\Properties\Resources.resx
文件 1094 2010-11-15 14:49 C#DrawDesign\Backup\DrawDesigns\Properties\Settings.Designer.cs
文件 249 2010-11-15 14:49 C#DrawDesign\Backup\DrawDesigns\Properties\Settings.settings
文件 923 2010-11-15 14:48 C#DrawDesign\Backup\DrawDesigns.sln
..A..H. 14848 2010-11-15 15:01 C#DrawDesign\Backup\DrawDesigns.suo
文件 35328 2017-11-05 11:35 C#DrawDesign\DrawDesigns\bin\Debug\C#DrawDesigns.exe
文件 34304 2017-11-05 11:35 C#DrawDesign\DrawDesigns\bin\Debug\C#DrawDesigns.pdb
文件 11608 2017-11-05 11:34 C#DrawDesign\DrawDesigns\bin\Debug\C#DrawDesigns.vshost.exe
文件 30208 2010-11-15 15:01 C#DrawDesign\DrawDesigns\bin\Debug\DrawDesigns.exe
文件 32256 2010-11-15 15:01 C#DrawDesign\DrawDesigns\bin\Debug\DrawDesigns.pdb
文件 2238 2010-07-27 23:25 C#DrawDesign\DrawDesigns\bin\Debug\MouseIcon\Curve.ico
文件 4710 2010-07-27 10:52 C#DrawDesign\DrawDesigns\bin\Debug\MouseIcon\Eraser.ico
文件 3638 2010-07-27 10:37 C#DrawDesign\DrawDesigns\bin\Debug\MouseIcon\Pen.ico
............此处省略61个文件信息
相关资源
- C#初级不涉及数据库的学生成绩管理系
- C#制作PDF以及源代码.rar
- 单像空间后方交会C#版
- C# Excel导入导出
- 适合于WinCE应用开发的压缩解压缩库
- C#监控剪切板
- 对C#的树型控件TREEVIEW添加背景图片
- 用c#写的五子棋源代码
- C#中在picturebox中实时画矩形框
- C#在一块空间中鼠标中键操作图像
- C#制作qq截图自动框选功能
- 显示所有缓存 清除所有缓存 Asp.net(
- C#自动截屏/定时截屏/自动保存/快捷键
- C# 通过鼠标滚轮实现缩放图片和移动
- C# 动态生成RDLC报表
- C#调用考勤机API读取记录
- c# 真正的线控件直线、斜线而且不会
- C#写的 模拟 cmd界面
- c# winform 超漂亮按钮 控件
- C# 内存处理器、网络上行与下行实时
- 仿QQ的C#源码、仿QQ的C#源码
- C#版人机对弈五子棋
- MPU6050 实时图表上位机 C#
- C#编码实现的开心消消乐游戏
- C# 计算机行为监控
- 定时调用接口小工具.zip
- C#实现shp文件的读取和显示程序
- 国密算法SM2、SM3、SM4的C#源码
- C# 模拟电梯控制源码
- C#节点的使用.zip
评论
共有 条评论