社区
组件/控件开发
帖子详情
winform C# 怎么在背景图上面用Gdi画出圆角矩形边框
qq_29783739
2015-09-01 11:50:11
如图
...全文
364
2
打赏
收藏
winform C# 怎么在背景图上面用Gdi画出圆角矩形边框
如图
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
bdmh
2015-09-01
打赏
举报
回复
圆角需要你自己绘制,四条直线,不要画到头,留一点地方绘制圆弧,函数都是有的
qq_29783739
2015-09-01
打赏
举报
回复
private GraphicsPath RoundRect(Rectangle r, int round) { GraphicsPath gp = new GraphicsPath(); r.Width = r.Width - 1; r.Height = r.Height - 1; int x = r.X; int y = r.Y; int w = r.Width; int h = r.Height; gp.AddArc(x, y, round, round, 180, 90); gp.AddArc(w - round, y, round, round, 270, 90); gp.AddArc(w - round, h - round, round, round, 0, 90); gp.AddArc(x, h - round, round, round, 90, 90); gp.CloseAllFigures(); return gp; } public void huaxian() //绘线条 { Bitmap im = (Bitmap)this.panel1.BackgroundImage; Graphics mygraphics = Graphics.FromImage(im); Pen mypen = new Pen(Color.Black, 5); mygraphics.DrawPath(new Pen(Color.Black, 5), RoundRect(this.panel1.ClientRectangle, 50)); mygraphics.Dispose(); this.panel1.BackgroundImageLayout = ImageLayout.Tile; this.panel1.BackgroundImage = im; } private void button1_Click(object sender, EventArgs e) { huaxian(); } 这是我写的方法为什么没效果呢
C#
开发
圆角
窗体
因为项目需要做个
Winform
的随机启动的数据上传工具,用Visual Studio的窗体感觉太丑了,就想进行优化,反正就一个窗体,
上面
也没啥按钮,就不要标题栏了,就搞一个
圆角
的窗体好了,搞个漂亮的
背景图
片。
上面
搞一个最小化和关闭按钮。把窗体设置为
圆角
窗口的操作如下:1、把窗体frmMain的FormBorderStyle属性设置为None,去掉窗体的
边框
,让窗...
C#
WinForm
Button 控件 3 种替代方案:Panel/Label/PictureBox 实战对比
本文深入探讨了
C#
WinForm
开发中Button控件的3种高阶替代方案:Panel、Label和PictureBox。通过详细的代码示例和性能对比,展示了如何利用这些控件实现自定义按钮效果,包括
圆角
设计、多状态管理和动画效果,帮助开发者突破标准Button的限制,提升应用界面表现力和交互体验。
【测绘摄影测量】空间前方交会数据
【测绘摄影测量】空间前方交会数据
1123bevdet-op-optimize.onnx
1123bevdet-op-optimize.onnx
组件/控件开发
8,832
社区成员
7,151
社区内容
发帖
与我相关
我的任务
组件/控件开发
.NET技术 组件/控件开发
复制链接
扫一扫
分享
社区描述
.NET技术 组件/控件开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章