admin 管理员组文章数量: 1086019
2023年12月22日发(作者:网页游戏源码分享网)
(C#)用户自定义控件-圆角Panel代码(WinForm)
上一篇 / 下一篇 2010-06-24 14:48:28 / 个人分类:WinForm
查看( 397 ) / 评论( 0 ) / 评分( 0 / 0 )
(C#)用户自定义控件-圆角Panel代码(WinForm) 圆角Panel代码
using System;
using c;
using entModel;
using stics;
using ;
using ;
namespace myControlLibrary
{
public partial class RoundPanel :
{
public RoundPanel()
{
InitializeComponent();
g = new g(0, 0, 0, 0);
= new g(0, 0, 0, 0);
oundImageLayout =
h;
}
// 圆角
//
===============================================================================================
private int _Radius; // 圆角弧度
///
[Browsable(true)]
[Description("圆角弧度(0为不要圆角)")]
public int _setRoundRadius
{
get
{
return _Radius;
}
set
{
if (value < 0) { _Radius = 0; }
else { _Radius = value; }
h();
}
}
// 圆角代码
public void Round( region)
{
//
-----------------------------------------------------------------------------------------------
// 已经是.net提供给我们的最容易的改窗体的属性了(以前要自己调API)
csPath oPath = new
csPath();
int x = 0;
int y = 0;
int thisWidth = ;
int thisHeight = ;
int angle = _Radius;
if (angle > 0)
{
cs g = CreateGraphics();
(x, y, angle, angle, 180, 90);
// 左上角
(thisWidth - angle, y, angle, angle, 270,
90); // 右上角
(thisWidth - angle, thisHeight - angle,
angle, angle, 0, 90); // 右下角
(x, thisHeight - angle, angle, angle, 90,
90); // 左下角
llFigures();
Region = new (oPath);
}
//
-----------------------------------------------------------------------------------------------
else
{
e(x + angle, y, thisWidth - angle, y);
// 顶端
e(thisWidth, y + angle, thisWidth,
thisHeight - angle); // 右边
e(thisWidth - angle, thisHeight, x + angle,
thisHeight); // 底边
e(x, y + angle, x, thisHeight - angle);
// 左边
llFigures();
Region = new (oPath);
}
}
//
===============================================================================================
public RoundPanel(IContainer container)
{
(this);
InitializeComponent();
}
protected override void
OnPaint(ventArgs pe)
{
t(pe);
Round(); // 圆角
}
protected override void OnResize(EventArgs eventargs)
{
ze(eventargs);
h();
}
}
}
/html/25/
版权声明:本文标题:(C#)用户自定义控件-圆角Panel代码(WinForm) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1703214435a442532.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论