双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

DrawLine 画线问题!!

pfworld pfworld 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

//字体左边到上最左边线
x0 = m_gap - 2;
y0 = xy;
x1 = 0;
y1 = xy;
g.DrawLine(forePenDark, x0, y0, x1, y1);
g.DrawLine(forePen, x0, y0 + 1, x1, y1 + 1);

//上最左边线到最左边下线
x0 = 0;
y0 = xy;
x1 = 0;
y1 = this.Height;
g.DrawLine(forePenDark, x0, y0, x1, y1);
g.DrawLine(forePen, x0 + 1, y0 + 1, x1 + 1, y1);

//下最左边线到下最右边下线
x0 = 0;
y0 = this.Height;
x1 = this.Width;
y1 = this.Height;
g.DrawLine(forePenDark, x0, y0, x1, y1);
g.DrawLine(forePen, x0, y0 + 3, x1, y1 +3);

//下最右边线到上最右边上线
x0 = this.Width;
y0 = this.Height;
x1 = this.Width;
y1 = xy;
g.DrawLine(forePenDark, x0, y0, x1, y1);
g.DrawLine(forePen, x0 + 2, y0, x1 + 2, y1);

//上最左边线到最左边下线
x0 = this.Width;
y0 = xy;
x1 = (int)stringSize.Width + m_gap;
y1 = xy;
g.DrawLine(forePenDark, x0, y0, x1, y1);
g.DrawLine(forePen, x0 - 2, y0 + 1, x1, y1 + 1);


或者


Point[] pArr = new Point[6];
pArr[0].X = m_gap - 2;
pArr[0].Y = xy;
pArr[1].X = 0;
pArr[1].Y = xy;
pArr[2].X = 0;
pArr[2].Y = this.Height;
pArr[3].X = this.Width;
pArr[3].Y = this.Height;
pArr[4].X = this.Width;
pArr[4].Y = xy;
pArr[5].X = (int)stringSize.Width + m_gap;
pArr[5].Y = ClientRectangle.Top + (int)(Font.Height / 2f);

g.DrawLines(forePenDark, pArr);
...全文

相关推荐

评论 17
收藏 已收藏
分享
返回顶部
pfworld
C# 111,129 成员 642,540 内容