计算机图形学课设--简易交互式绘图程序


利用C#编写的简易交互式绘图程序,实现了橡皮筋技术绘制椭圆、圆、矩形、正方形、点、直线、曲线、Bezier,填充、裁剪等功能,包含课设报告
资源截图
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

using System.Runtime.InteropServices;//
using System.Threading;
using System.Linq;

namespace KS_Graphics
{
    public partial class KS_Graphics : Form
    {

        [DllImport(“gdi32.dll“)]
        private static extern int SetPixel(IntPtr hdc int x1 int y1 int color);
        [DllImport(“gdi32.dll“)]
        private static extern uint GetPixel(IntPtr hdc int XPos int YPos);
        [DllImport(“gdi32.dll“)]
        private static extern uint GetPixel(IntPtr hdc Point p);

        


        int function = 0;       //用于判断按下什么键,0选择,1直线,2.曲线,3.矩形,4.椭圆,5.橡皮檫6.填充7.Bezier,8.点
       
        string functionInfo;    //用于程序底部显示当前操作信息

        public Point startPoint = new Point();      //起点坐标
        public Point endPoint = new Point();        //终点坐标
        public Point sStartPoint = new Point();     //用于记录“选择”模式下第一次点击左键时的坐标(选择框的左上角的坐标)
        public Point sEndPoint = new Point();       //光标此时的坐标(选择框右下角的坐标)
        
        public Point b1Point = new Point();     //用于记录绘制Bezier曲线时需要绘制的4个点
        public Point b2Point = new Point();     //用于记录绘制Bezier曲线时需要绘制的4个点
        public Point b3Point = new Point();     //用于记录绘制Bezier曲线时需要绘制的4个点
        public Point b4Point = new Point();     //用于记录绘制Bezier曲线时需要绘制的4个点


        public Rectangle selectBox;     //选择框
        Pen eraser = new Pen(Color.White 20);      //橡皮檫
       

        float rotate;       //旋转角度

        float tensileX = 1;     //拉伸值
        float tensileY = 1;     //拉伸值
       

        int penWidth;       //画笔粗细

        int bcount = 0;     //bezeer区间,鼠标点击次数
        

        Point E;        //选择框起点,用于裁剪

        bool saveState = false;     //标识是否已经保存图形,用于关闭程序时判断
        bool cutting = false;       //用于判断是否裁剪
        private bool mouseLeft = false;     //表示左键按下状态
        public Color color = Color.Black;       //设置默认颜色为黑色

        public Pen pen = new Pen(Color.Black 1);       //设置默认画笔样式


        public bool ctrlDown;       //判断ctrl键是否按下

        string s_FileName = ““;     //初始文件名
        public Bitmap bits;         //位图,用于绘制点
        public Graphics bitG;       //绘图对象,用于在位图中绘制
        
        /*下面变量用于使用副本位图进行图形编辑时*/
        public Point s1=new Point(00);     
        public Point s2=new Point(735408);
        public Bitmap bita;
        public Bitmap bitb;
        PixelFormat formata;



        private System.Drawing.Text.InstalledFontCollection objFont = new System.Drawing.Text.InstalledFontCollection();

        public KS_Graphics()
        {
            InitializeComponent();

            bits = new Bitmap(pictureBox1.Width pictureBox1.Height);   
            bitG = Graphics.FromImage(bits);       
            bitG.Clear(Color.White);       
            pi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-01-20 18:26  计算机图形学课设--简易交互式绘图程序
     目录           0  2017-01-20 18:26  计算机图形学课设--简易交互式绘图程序KS_Graphics
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_Graphics.vs
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_Graphics.vsKS_Graphics
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_Graphics.vsKS_Graphicsv14
     文件       45056  2017-01-16 13:47  计算机图形学课设--简易交互式绘图程序KS_Graphics.vsKS_Graphicsv14.suo
     文件         161  2017-01-12 23:14  计算机图形学课设--简易交互式绘图程序KS_Graphicsapp.config
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_Graphicsin
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsinDebug
     文件      751104  2017-01-16 13:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsinDebugKS_Graphics.exe
     文件         161  2017-01-12 23:14  计算机图形学课设--简易交互式绘图程序KS_GraphicsinDebugKS_Graphics.exe.config
     文件       42496  2017-01-16 13:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsinDebugKS_Graphics.pdb
     文件       22688  2017-01-16 13:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsinDebugKS_Graphics.vshost.exe
     文件         161  2017-01-12 23:14  计算机图形学课设--简易交互式绘图程序KS_GraphicsinDebugKS_Graphics.vshost.exe.config
     文件         490  2015-10-30 15:19  计算机图形学课设--简易交互式绘图程序KS_GraphicsinDebugKS_Graphics.vshost.exe.manifest
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsinRelease
     文件      750592  2017-01-15 19:49  计算机图形学课设--简易交互式绘图程序KS_GraphicsinReleaseKS_Graphics.exe
     文件         161  2017-01-12 23:14  计算机图形学课设--简易交互式绘图程序KS_GraphicsinReleaseKS_Graphics.exe.config
     文件       40448  2017-01-15 19:49  计算机图形学课设--简易交互式绘图程序KS_GraphicsinReleaseKS_Graphics.pdb
     文件       27594  2017-01-15 20:23  计算机图形学课设--简易交互式绘图程序KS_GraphicsForm1.cs
     文件       26654  2017-01-15 17:07  计算机图形学课设--简易交互式绘图程序KS_GraphicsForm1.Designer.cs
     文件        6797  2017-01-15 17:07  计算机图形学课设--简易交互式绘图程序KS_GraphicsForm1.resx
     文件        5389  2017-01-15 19:48  计算机图形学课设--简易交互式绘图程序KS_GraphicsKS_Graphics.csproj
     文件         990  2017-01-12 00:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsKS_Graphics.sln
     文件       38400  2017-01-15 19:55  计算机图形学课设--简易交互式绘图程序KS_GraphicsKS_Graphics.v12.suo
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_Graphicsobj
     目录           0  2017-01-15 23:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsobjDebug
     文件         864  2017-01-15 20:01  计算机图形学课设--简易交互式绘图程序KS_GraphicsobjDebugDesignTimeResolveAssemblyReferences.cache
     文件        6777  2017-01-16 13:08  计算机图形学课设--简易交互式绘图程序KS_GraphicsobjDebugDesignTimeResolveAssemblyReferencesInput.cache
     文件        5462  2017-01-16 13:47  计算机图形学课设--简易交互式绘图程序KS_GraphicsobjDebugKS_Graphics.csproj.FileListAbsolute.txt
     文件        1012  2017-01-15 20:10  计算机图形学课设--简易交互式绘图程序KS_GraphicsobjDebugKS_Graphics.csproj.GenerateResource.Cache
............此处省略97个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)