开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 122

库卡青年/DevelopAssistant

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
标签 (3)
master
V5.0.2
V4.8.32
V4.3.31
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
项目仓库所选许可证以仓库主分支所使用许可证为准
master
分支 (1)
标签 (3)
master
V5.0.2
V4.8.32
V4.3.31
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
标签 (3)
master
V5.0.2
V4.8.32
V4.3.31
GraphicsPathHelper.cs 11.42 KB
一键复制 编辑 原始数据 按行查看 历史
wxd_tony1984 提交于 2016年04月11日 22:24 +08:00 . 一些修改
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
/*
* 本代码受中华人民共和国著作权法保护,作者仅授权下载代码之人在学习和交流范围内
* 自由使用与修改代码;欲将代码用于商业用途的,请与作者联系。
* 使用本代码请保留此处信息。作者联系方式:ping3108@163.com, 欢迎进行技术交流
*/
using ICSharpCode.WinFormsUI.Controls;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ICSharpCode.WinFormsUI.NGraphics
{
/// <summary>
/// 提供产生各种路径的静态方法,比如圆角路径、关闭按钮上的x路径、+号路径
/// </summary>
internal static class GraphicsPathHelper
{
/// <summary>
/// 画圆角矩形
/// </summary>
/// <param name="rect"></param>
/// <param name="cornerRadius"></param>
/// <returns></returns>
public static GraphicsPath CreateRoundedRectPath(Rectangle rect, int radius, RoundStyle type, bool shorten)
{
GraphicsPath roundedRect = new GraphicsPath();
roundedRect.AddArc(rect.X, rect.Y, radius * 2, radius * 2, 180, 90);
roundedRect.AddLine(rect.X + radius, rect.Y, rect.Right - radius * 2, rect.Y);
roundedRect.AddArc(rect.X + rect.Width - radius * 2, rect.Y, radius * 2, radius * 2, 270, 90);
roundedRect.AddLine(rect.Right, rect.Y + radius * 2, rect.Right, rect.Y + rect.Height - radius * 2);
roundedRect.AddArc(rect.X + rect.Width - radius * 2, rect.Y + rect.Height - radius * 2, radius * 2, radius * 2, 0, 90);
roundedRect.AddLine(rect.Right - radius * 2, rect.Bottom, rect.X + radius * 2, rect.Bottom);
roundedRect.AddArc(rect.X, rect.Bottom - radius * 2, radius * 2, radius * 2, 90, 90);
roundedRect.AddLine(rect.X, rect.Bottom - radius * 2, rect.X, rect.Y + radius * 2);
roundedRect.CloseFigure();
return roundedRect;
}
public static GraphicsPath CreateRoundedRect(Rectangle rect, int radius, RoundStyle type, bool shorten)
{
GraphicsPath path = new GraphicsPath();
if (shorten)
{
rect.Width--;
rect.Height--;
}
Rectangle rectTopLeft = new Rectangle(rect.X, rect.Y, radius, radius);
Rectangle rectTopRight = new Rectangle(rect.Right - radius, rect.Y, radius, radius);
Rectangle rectBottomLeft = new Rectangle(rect.X, rect.Bottom - radius, radius, radius);
Rectangle rectBottomRight = new Rectangle(rect.Right - radius, rect.Bottom - radius, radius, radius);
Point p1 = new Point(rect.X, rect.Y);
Point p2 = new Point(rect.Right, rect.Y);
Point p3 = new Point(rect.Right, rect.Bottom);
Point p4 = new Point(rect.X, rect.Bottom);
switch (type)
{
case RoundStyle.None:
path.AddRectangle(rect);
break;
case RoundStyle.All:
path.AddArc(rectTopLeft, 180, 90);
path.AddArc(rectTopRight, 270, 90);
path.AddArc(rectBottomRight, 0, 90);
path.AddArc(rectBottomLeft, 90, 90);
break;
case RoundStyle.Top:
path.AddArc(rectTopLeft, 180, 90);
path.AddArc(rectTopRight, 270, 90);
path.AddLine(p3, p4);
break;
case RoundStyle.Bottom:
path.AddArc(rectBottomRight, 0, 90);
path.AddArc(rectBottomLeft, 90, 90);
path.AddLine(p1, p2);
break;
case RoundStyle.Left:
path.AddArc(rectBottomLeft, 90, 90);
path.AddArc(rectTopLeft, 180, 90);
path.AddLine(p2, p3);
break;
case RoundStyle.Right:
path.AddArc(rectTopRight, 270, 90);
path.AddArc(rectBottomRight, 0, 90);
path.AddLine(p4, p1);
break;
default:
break;
}
path.CloseFigure();
return path;
}
public static GraphicsPath CreateMinimizeFlagPath(Rectangle rect)
{
GraphicsPath path = new GraphicsPath();
int x = rect.X + (rect.Width - 9) / 2;
int y = rect.Y + (rect.Height - 7) / 2;
Point p1 = new Point(x + 1, y + 5);
Point p2 = new Point(x + 7, y + 5);
Point p3 = new Point(x + 1, y + 6);
Point p4 = new Point(x + 7, y + 6);
path.AddLines(new Point[] { p1, p2, p3, p4 });
return path;
}
public static GraphicsPath CreateMaximizeFlagPath(Rectangle rect)
{
GraphicsPath path = new GraphicsPath();
int x = rect.X + (rect.Width - 9) / 2;
int y = rect.Y + (rect.Height - 7) / 2;
Point p1 = new Point(x + 1, y + 1);
Point p2 = new Point(x + 7, y + 1);
path.AddRectangle(new Rectangle(new Point(x, y), new Size(8, 6)));
path.CloseFigure();
path.AddLine(p1, p2);
return path;
}
public static GraphicsPath CreateRestoreFlagPath(Rectangle rect)
{
GraphicsPath path = new GraphicsPath();
int x = rect.X + (rect.Width - 11) / 2;
int y = rect.Y + (rect.Height - 9) / 2;
Point p1 = new Point(x, y + 3);
Point p2 = new Point(x + 6, y + 3);
Point p3 = new Point(x + 6, y + 4);
Point p4 = new Point(x + 6, y + 8);
Point p5 = new Point(x, y + 8);
Point p6 = new Point(x, y + 4);
Point p7 = new Point(x + 7, y + 5);
Point p8 = new Point(x + 9, y + 5);
Point p9 = new Point(x + 9, y + 1);
Point p10 = new Point(x + 3, y + 1);
Point p11 = new Point(x + 3, y + 2);
Point p12 = new Point(x + 3, y);
Point p13 = new Point(x + 9, y);
path.AddLines(new Point[] { p1, p2, p4, p5, p6, p3, p2, p1 });
path.CloseFigure();
path.AddLines(new Point[] { p7, p8, p9, p10, p11, p12, p13, p8, p7 });
return path;
}
public static GraphicsPath CreateCloseFlagPath(Rectangle rect)
{
GraphicsPath path = new GraphicsPath();
int x = rect.X + (rect.Width - 9) / 2;
int y = rect.Y + (rect.Height - 7) / 2;
Point p1 = new Point(x + 1-1, y-1);
Point p2 = new Point(x + 7, y + 6);
Point p3 = new Point(x + 8, y + 6);
Point p4 = new Point(x + 2-1, y-1);
Point p5 = new Point(x + 6+1, y-1);
Point p6 = new Point(x, y + 6);
Point p7 = new Point(x + 1, y + 6);
Point p8 = new Point(x + 7+1, y-1);
path.AddLine(p1, p2);
path.AddLine(p3, p4);
path.CloseFigure();
path.AddLine(p5, p6);
path.AddLine(p7, p8);
return path;
}
public static GraphicsPath CreateTopRoundedPathForFormRegion(Rectangle rect)
{
GraphicsPath path = new GraphicsPath();
Point pBL = new Point(rect.X, rect.Bottom); // bottom left
Point pBR = new Point(rect.Right, rect.Bottom); // bottom right
int x = rect.X, y = rect.Y, r = rect.Right;
Point p1 = new Point(x, y + 4);
Point p2 = new Point(x + 1, y + 4);
Point p3 = new Point(x + 1, y + 2);
Point p4 = new Point(x + 2, y + 2);
Point p5 = new Point(x + 2, y + 1);
Point p6 = new Point(x + 4, y + 1);
Point p7 = new Point(x + 4, y);
Point p8 = new Point(r - 4, y);
Point p9 = new Point(r - 4, y + 1);
Point p10 = new Point(r - 2, y + 1);
Point p11 = new Point(r - 2, y + 2);
Point p12 = new Point(r - 1, y + 2);
Point p13 = new Point(r - 1, y + 4);
Point p14 = new Point(r, y + 4);
path.AddLines(new Point[] { p1, p2, p3, p4, p5, p6, p7 });
path.AddLines(new Point[] { p8, p9, p10, p11, p12, p13, p14 });
path.AddLine(pBR, pBL);
path.CloseFigure();
return path;
}
public static GraphicsPath CreateSingleLineCloseFlag(Rectangle rect, int width)
{
GraphicsPath path = new GraphicsPath();
int x = rect.X + (rect.Width - width) / 2;
int y = rect.Y + (rect.Height - width) / 2;
Point p1 = new Point(x, y);
Point p2 = new Point(x + width, y);
Point p3 = new Point(x + width, y + width);
Point p4 = new Point(x, y + width);
path.AddLine(p1, p3);
path.CloseFigure();
path.AddLine(p2, p4);
return path;
}
public static GraphicsPath CreateSingleLineCloseFlag(Rectangle rect)
{
return CreateSingleLineCloseFlag(rect, 6);
}
public static GraphicsPath CreatePlusFlag(Rectangle rect, int width)
{
GraphicsPath path = new GraphicsPath();
if (width % 2 == 1)
width++;
int x = rect.X + (rect.Width - width) / 2;
int y = rect.Y + (rect.Height - width) / 2;
Point p1 = new Point(x + width / 2 - 1, y);
Point p2 = new Point(x + width / 2 - 1, y + width - 1);
Point p3 = new Point(x + width / 2, y + width - 1);
Point p4 = new Point(x + width / 2, y);
Point p5 = new Point(x, y + width / 2 - 1);
Point p6 = new Point(x + width - 1, y + width / 2 - 1);
Point p7 = new Point(x + width - 1, y + width / 2);
Point p8 = new Point(x, y + width / 2);
path.AddLines(new Point[] { p1, p2, p3, p4 });
path.CloseFigure();
path.AddLines(new Point[] { p5, p6, p7, p8 });
return path;
}
public static GraphicsPath CreatePlusFlag(Rectangle rect)
{
return CreatePlusFlag(rect, 10);
}
public static GraphicsPath CreateDownTriangleFlag(Rectangle rect)
{
GraphicsPath path = new GraphicsPath();
int x = rect.X + (rect.Width - 10) / 2;
int y = rect.Y + (rect.Height - 9) / 2;
if (rect.Height % 2 == 0)
y++;
Point p1 = new Point(x, y);
Point p2 = new Point(x + 9, y);
Point p3 = new Point(x + 9, y + 1);
Point p4 = new Point(x, y + 1);
path.AddLines(new Point[] { p1, p2, p3, p4 });
path.CloseFigure();
int x1 = x, y1 = y + 4, x2 = x + 9, y2 = y + 4;
for (int i = 1; i <= 5; i++)
{
if (i % 2 == 0)
path.AddLine(x2, y2, x1, y1);
else
path.AddLine(x1, y1, x2, y2);
x1++;
x2--;
y1++;
y2++;
}
return path;
}
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

开发助手是一款面向开发人员的辅助助手,它集数据库管理(目前支持sqlserver,sqlite,mysql,postgresql),代码生成(支持从数据库生成实体映射类,数据库操作DAL中间层),数据库文档生成,代码收藏夹(支持C#,SQL,Javascrip,Html,XML,Python语法高亮),富文本编辑,插件管理等功能模块。自2015年到如今,它已经历过4个重大版本的升级,径过不断修复和完善,目前已成为一款堪称得心应手的开发辅助工具。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/wwwpythonpw/DevelopAssistant.git
git@gitee.com:wwwpythonpw/DevelopAssistant.git
wwwpythonpw
DevelopAssistant
DevelopAssistant
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /