日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

GDI 绘制圆角矩形

發(fā)布時間:2025/3/21 编程问答 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 GDI 绘制圆角矩形 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

代碼從網(wǎng)上搜集

#region 圓角矩形/// /// 最大圓角半徑/// protected const int MaxRoundRadius = 3;/// /// 最小矩形邊長,用于自動處理圓角大小/// protected const int MinBorderLength = 20;/// /// 繪制一個圓角矩形./// /// 當(dāng)前屏幕的圖形對象/// 矩形線條的顏色/// 矩形左上角X坐標(biāo)/// 矩形左上角Y坐標(biāo)/// 矩形右下角X坐標(biāo)/// 矩形右下角Y坐標(biāo)/// 圓角的半徑長度public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Color lineColor, int nLeft, int nTop, int nRight, int nBottom, int round){if (round > MaxRoundRadius){round = MaxRoundRadius;}else if (round < 0){round = 0;}if (Math.Abs(nRight - nLeft) < MinBorderLength && Math.Abs(nBottom - nTop) < MinBorderLength){round = 1;}Point Polygon1 = new Point(nLeft + round, nTop);Point Polygon2 = new Point(nRight - round + 1, nTop);Point Polygon3 = new Point(nLeft, nTop + round);Point Polygon4 = new Point(nRight + 1, nTop + round);Point Polygon5 = new Point(nLeft, nBottom - round);Point Polygon6 = new Point(nRight + 1, nBottom - round);Point Polygon7 = new Point(nLeft + round, nBottom + 1);Point Polygon8 = new Point(nRight - round, nBottom + 1);//四條主線(上下左右)currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon1.X, Polygon1.Y, Polygon2.X, Polygon2.Y);currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon7.X, Polygon7.Y, Polygon8.X, Polygon8.Y);currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon3.X, Polygon3.Y, Polygon5.X, Polygon5.Y);currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon4.X, Polygon4.Y, Polygon6.X, Polygon6.Y);//四個邊角currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon1.X, Polygon1.Y, Polygon3.X, Polygon3.Y);currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon2.X, Polygon2.Y, Polygon4.X, Polygon4.Y);currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon5.X, Polygon5.Y, Polygon7.X, Polygon7.Y);currentGraphicObject.DrawLine(new System.Drawing.Pen(lineColor), Polygon6.X, Polygon6.Y, Polygon8.X, Polygon8.Y);}/// /// 繪制一個圓角矩形./// /// 當(dāng)前屏幕的圖形對象/// 矩形線條的顏色/// 要繪制的矩形對象/// 圓角的半徑長度public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Color lineColor, Rectangle rect, int round){DrawRoundRect(currentGraphicObject, lineColor, rect.Left, rect.Top, rect.Right, rect.Bottom, round);}/// /// 繪制一個圓角矩形./// /// 當(dāng)前屏幕的圖形對象/// 矩形線條的顏色/// 要繪制的矩形對象public static void DrawRoundRect(System.Drawing.Graphics currentGraphicObject, Color lineColor, Rectangle rect){DrawRoundRect(currentGraphicObject, lineColor, rect.Left, rect.Top, rect.Right, rect.Bottom, 2);}/// /// 填充一個圓角矩形./// /// 當(dāng)前屏幕的圖形對象/// 矩形線條的顏色/// 矩形左上角X坐標(biāo)/// 矩形左上角Y坐標(biāo)/// 矩形右下角X坐標(biāo)/// 矩形右下角Y坐標(biāo)/// 圓角的半徑長度public static void FillRoundRect(System.Drawing.Graphics currentGraphicObject, Color fillColor, int nLeft, int nTop, int nRight, int nBottom, int round){if (round > MaxRoundRadius){round = MaxRoundRadius;}else if (round < 0){round = 0;}if (Math.Abs(nRight - nLeft) < MinBorderLength && Math.Abs(nBottom - nTop) < MinBorderLength){round = 1;}Point Polygon1 = new Point(nLeft + round, nTop);Point Polygon2 = new Point(nRight - round + 1, nTop);Point Polygon3 = new Point(nLeft, nTop + round);Point Polygon4 = new Point(nRight + 1, nTop + round);Point Polygon5 = new Point(nLeft, nBottom - round);Point Polygon6 = new Point(nRight + 1, nBottom - round);Point Polygon7 = new Point(nLeft + round, nBottom + 1);Point Polygon8 = new Point(nRight - round, nBottom + 1);currentGraphicObject.FillPolygon(new System.Drawing.SolidBrush(fillColor), new Point[]{ Polygon1,Polygon3,Polygon5,Polygon7,Polygon8,Polygon6,Polygon4,Polygon2});}/// /// 填充一個圓角矩形./// /// 當(dāng)前屏幕的圖形對象/// 矩形線條的顏色/// 要填充的矩形/// 填充區(qū)域針對矩形的縮進(jìn)距離/// 圓角的半徑長度public static void FillRoundRect(System.Drawing.Graphics currentGraphicObject, Color lineColor, Rectangle rect, int indentSize, int round){FillRoundRect(currentGraphicObject, lineColor, rect.Left + indentSize, rect.Top + indentSize, rect.Right - indentSize + 1, rect.Bottom - indentSize + 1, round);}/// /// 填充一個圓角矩形./// /// 當(dāng)前屏幕的圖形對象/// 矩形線條的顏色/// 要填充的矩形public static void FillRoundRect(System.Drawing.Graphics currentGraphicObject, Color lineColor, Rectangle rect){FillRoundRect(currentGraphicObject, lineColor, rect, 0, 2);}public static void FillRoundTitle(System.Drawing.Graphics currentGraphicObject, Color fillColor, int nLeft, int nTop, int nRight, int nBottom, int round,int Height){if (round > MaxRoundRadius){round = MaxRoundRadius;}else if (round < 0){round = 0;}if (Math.Abs(nRight - nLeft) < MinBorderLength && Math.Abs(nBottom - nTop) < MinBorderLength){round = 1;}Point Polygon1 = new Point(nLeft + round, nTop);Point Polygon2 = new Point(nRight - round + 1, nTop);Point Polygon3 = new Point(nLeft, nTop + round);Point Polygon4 = new Point(nRight + 1, nTop + round);Point Polygon5 = new Point(nLeft, nTop + Height);Point Polygon6 = new Point(nRight + 1, nTop + Height);currentGraphicObject.FillPolygon(new System.Drawing.SolidBrush(fillColor), new Point[]{ Polygon1,Polygon3,Polygon5,Polygon6,Polygon4,Polygon2});}public static void FillRoundTitle(System.Drawing.Graphics currentGraphicObject, Color lineColor, Rectangle rect, int indentSize, int round, int Height){FillRoundTitle(currentGraphicObject, lineColor, rect.Left + indentSize, rect.Top + indentSize, rect.Right - indentSize + 1, rect.Bottom - indentSize + 1, round, Height);}#endregion

?

轉(zhuǎn)載于:https://www.cnblogs.com/zhangjianli/archive/2012/06/01/2530921.html

總結(jié)

以上是生活随笔為你收集整理的GDI 绘制圆角矩形的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 欧美午夜一区 | 成人欧美在线 | 91中文字幕在线 | 91亚洲视频在线 | 亚洲熟妇无码一区二区三区导航 | 91社区福利 | 91精品国产综合久久久密臀九色 | 日韩黄 | 国产激情福利 | 国产又大又硬又粗 | 伊人影视网 | 亚洲国产精品99久久久久久久久 | 中文字幕欲求不满 | 四虎影院在线视频 | 亚洲精品国产av | 三级欧美日韩 | 免费一级毛片麻豆精品 | 午夜免费体验区 | 天天操穴 | 18精品爽国产白嫩精品 | 天天操好逼 | 在线播放视频高清在线观看 | 亚洲精品9 | 人妻一区二区视频 | 日本韩国三级 | 中文字幕一区二区三区免费 | 人妻少妇被猛烈进入中文字幕 | 亚洲色图首页 | 亚洲av综合永久无码精品天堂 | 国产不卡a| 一区二区福利电影 | 国产亚洲激情 | 精品视频在线观看免费 | 无码少妇一区二区 | 中文av一区二区 | 中文字幕欧美色图 | 国产又色又爽无遮挡免费动态图 | 精品97人妻无码中文永久在线 | eeuss鲁片一区二区三区在线观看 | 日本妈妈3 | 亚洲高清资源 | 国产乱国产乱老熟300部视频 | 人妻互换免费中文字幕 | www.久久 | 好吊操视频这里只有精品 | 亚洲精品丝袜 | 熟女肥臀白浆大屁股一区二区 | 免费在线毛片 | 91av免费在线观看 | 少妇久久久久久久久久 | 天天国产视频 | 亚洲日本天堂 | 天天色天天操天天 | 日韩在线免费看 | 亚色视频在线 | 午夜家庭影院 | 国产特级aaaaaa大片 | 少妇视频网 | 国产 丝袜 欧美中文 另类 | 一区二区视频在线观看 | 日日插日日操 | 亚洲射射| 亚洲天堂热| 国产青青在线 | 亚州国产精品视频 | 他揉捏她两乳不停呻吟动态图 | 91福利网站| 538在线精品 | 精品一区二区三区蜜臀 | 不卡在线一区二区 | 国产精品69久久久久 | 潘金莲激情呻吟欲求不满视频 | 一级特黄色片 | n0659极腔濑亚美莉在线播放播放 | 免费看国产片在线观看 | 超碰在线| 久久精品—区二区三区舞蹈 | 网址你懂的在线 | 免费的一级黄色片 | 九九色在线 | 97se综合 | 黄色在线观看网站 | 毛片大全免费 | 国产经典一区 | 亚洲一二三四视频 | 欧美性福利 | 国产一区二区免费看 | 国产无遮挡呻吟娇喘视频 | 亚洲国产一区二区在线 | 在线视频精品免费 | 日日摸夜夜爽 | 亚洲国产一区二区三区四区 | 欧美日韩综合视频 | 国产又黄又 | 欧美区一区 | 日韩一区二区精品 | 黄色一级视频免费观看 | 一区二区三区网站 | 久久99视频精品 |