winform GDI基础(三)实现画笔
在程序窗口上使用鼠标画图
private Point pStart, pEnd;
private bool isAllowDraw = false;
private bool isOpenPen = false;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (isOpenPen)
{
isAllowDraw = true;
pStart = pEnd = e.Location;
}
} private void Form1_MouseUp(object sender, MouseEventArgs e)
{
if (isOpenPen)
{
isAllowDraw = false;
}
} private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (isOpenPen && isAllowDraw)
{
pEnd = e.Location; Graphics g = this.CreateGraphics();
g.SmoothingMode = SmoothingMode.HighQuality;//去掉锯齿
System.Drawing.Pen pen = new System.Drawing.Pen(Color.Red, 4);
g.DrawLine(pen, pStart, pEnd); pStart = pEnd;
}
}
winform GDI基础(三)实现画笔的更多相关文章
- winform GDI基础(四)简单截屏
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); G ...
- winform GDI基础(二)画带圆角的矩形框
private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.SmoothingMode ...
- winform GDI基础(一)
1获取画布 (1)从PaintEventArgs类中获取画布 private void Form1_Paint(object sender, PaintEventArgs e) { Graphics ...
- 从零开始学习GDI+ (三) 画笔与画刷
- WinForm GDI+ 资料收集
UI(User Interface)编程在整个项目开发过程中是个颇为重要的环节,任何好的解决方案若没有良好的用户界面呈现给最终用户,那么就算包含了最先进的技术也不能算是好程序.UI编程体现在两个方面, ...
- Winform GDI+
什么是GDI+ GDI (Graphics Device Interface), 是属于绘图方面的 API (Application Programming Interface). 因为应用程序不能直 ...
- Python全栈开发【基础三】
Python全栈开发[基础三] 本节内容: 函数(全局与局部变量) 递归 内置函数 函数 一.定义和使用 函数最重要的是减少代码的重用性和增强代码可读性 def 函数名(参数): ... 函数体 . ...
- Bootstrap <基础三十二>模态框(Modal)插件
模态框(Modal)是覆盖在父窗体上的子窗体.通常,目的是显示来自一个单独的源的内容,可以在不离开父窗体的情况下有一些互动.子窗体可提供信息.交互等. 如果您想要单独引用该插件的功能,那么您需要引用 ...
- Bootstrap <基础三十一>插件概览
在前面布局组件中所讨论到的组件仅仅是个开始.Bootstrap 自带 12 种 jQuery 插件,扩展了功能,可以给站点添加更多的互动.即使不是一名高级的 JavaScript 开发人员,也可以着手 ...
随机推荐
- BZOJ4009:[HNOI2015]接水果(整体二分版)
浅谈离线分治算法:https://www.cnblogs.com/AKMer/p/10415556.html 题目传送门:https://lydsy.com/JudgeOnline/problem.p ...
- Object-C类、方法、构造函数(2)
Object-C 代码分为三部分:.h文件..m文件及调用文件 .h源文件 #import <Foundation/Foundation.h> @interface Student:NSO ...
- 一文读懂非关系型数据库(NoSQL)
为了更好的理解非关系型数据库,我又深入的度娘了下 原文地址:https://baijiahao.baidu.com/po/feed/share?wfr=spider&for=pc&co ...
- C# Dynamic通用反序列化Json类型并遍历属性比较
背景 : 最近在做JAVA 3D API重写,重写的结果需要与原有的API结果进行比较,只有结果一致时才能说明接口是等价重写的,为此需要做一个API结果比较的工具,比较的内容就是Json内容,但是为了 ...
- RabbitMQ 消息队列 安装及使用
RabbitMQ 消息队列安装: linux版本:CentOS 7 安装第一步:先关闭防火墙 1.Centos7.x关闭防火墙 [root@rabbitmq /]# systemctl stop fi ...
- FFMPEG: avformat_find_stream_info()函数
av_find_stream_info()中是要不断的读取数据包,解码获得相应的信息 其中: st->codec->codec_type:0:视频,1:音频,2:数据 st->cod ...
- paramiko远程
安装paramiko后,看下面例子: 复制代码代码如下: import paramiko #设置ssh连接的远程主机地址和端口t=paramiko.Transport((ip,port))#设置登录名 ...
- HDLM命令dlnkmgr详解之四_monitor/offline/online
1. monitor 以一定的时间间隔监控hba或cha口的IO信息. 命令格式 监控hba口的IO信息: dlnkmgr monitor -hbaid HBA_ID [-intvl Interval ...
- eclipse和myeclipse的下载地址
官方下载地址: Eclipse 标准版 x86 http://mirror.hust.edu.cn/eclipse//technology/epp/downloads/release/luna/R/e ...
- Shell编程进阶 1.7 case选择
逻辑判断的格式 vim case.sh #!/bin/bash read -p "please input a number:" n m=$[$n%] case $m in ) e ...