C#中Tab控件:怎样改变上方按钮的样式 就是让Tab控件上方的按钮不是长方形的,改称vs中的样式。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我做不到,好象很不容易的.Mark! 需要自定义控件,比如Label控件,然后建立一个梯形的路径GraphicsPath对象,假设名称为path,然后这样将path赋值给控件的this.Region = new Region(path);即可。并且还可以在控件的Paint事件中填充背景为渐变颜色,很不错。 给搂主贴下获取梯形GraphicsPath对象的方法吧://rect参数是用来设置梯形的大小,nRoundRadius用来设置梯形斜坡处的圆角的半径private GraphicsPath GetRoundTrapeziaPath(Rectangle rect, int nRoundRadius){ GraphicsPath path = new GraphicsPath(); Point topLineLeft = new Point((rect.X + rect.Height) + nRoundRadius, rect.Y); Point topLineRight = new Point((rect.X + rect.Width) - nRoundRadius, rect.Y); Point rightLineTop = new Point(rect.X + rect.Width, rect.Y + nRoundRadius); Point rightLineBottom = new Point(rect.X + rect.Width, rect.Y + rect.Height); Point bottomLineLeft = new Point(rect.X, rect.Y + rect.Height); Point bottomLineRight = rightLineBottom; Rectangle leftTopArcRect = new Rectangle(topLineLeft.X - (nRoundRadius * 3), rect.Y, nRoundRadius * 6, nRoundRadius * 6); Rectangle rightTopArcRect = new Rectangle(rect.Width - (nRoundRadius * 2), rect.Y, nRoundRadius * 2, nRoundRadius * 2); path.AddLine(topLineLeft, topLineRight); path.AddArc(rightTopArcRect, 270f, 90f); path.AddLine(rightLineTop, rightLineBottom); path.AddLine(bottomLineRight, bottomLineLeft); path.AddArc(leftTopArcRect, 210f, 60f); path.CloseFigure(); return path;} C#调用dll后运算速度降低 TableLayoutPanel的边框色,如何设置? 数据库区无人,我来这里跪求! delegate--小女子请教各位大虾:) 在C#下格式化一条SQL语句,如果语句比较长,怎么换行呢? 如何获取一个枚举的所有类型 求一个正则表达式(C#) 请问,我想做一个停靠栏在窗体的左侧,并可以隐藏,给个思路(初学者)! .Net类库有多少个类? 在FORM编程中dataGrid可以实现分页吗? 问个控件 如何使你的程序不会在任何管理器的进程里被关掉, 或隐藏起来?
然后这样将path赋值给控件的this.Region = new Region(path);即可。并且还可以在控件的Paint事件中填充背景为渐变颜色,很不错。
private GraphicsPath GetRoundTrapeziaPath(Rectangle rect, int nRoundRadius)
{
GraphicsPath path = new GraphicsPath();
Point topLineLeft = new Point((rect.X + rect.Height) + nRoundRadius, rect.Y);
Point topLineRight = new Point((rect.X + rect.Width) - nRoundRadius, rect.Y);
Point rightLineTop = new Point(rect.X + rect.Width, rect.Y + nRoundRadius);
Point rightLineBottom = new Point(rect.X + rect.Width, rect.Y + rect.Height);
Point bottomLineLeft = new Point(rect.X, rect.Y + rect.Height);
Point bottomLineRight = rightLineBottom;
Rectangle leftTopArcRect = new Rectangle(topLineLeft.X - (nRoundRadius * 3), rect.Y, nRoundRadius * 6, nRoundRadius * 6);
Rectangle rightTopArcRect = new Rectangle(rect.Width - (nRoundRadius * 2), rect.Y, nRoundRadius * 2, nRoundRadius * 2);
path.AddLine(topLineLeft, topLineRight);
path.AddArc(rightTopArcRect, 270f, 90f);
path.AddLine(rightLineTop, rightLineBottom);
path.AddLine(bottomLineRight, bottomLineLeft);
path.AddArc(leftTopArcRect, 210f, 60f);
path.CloseFigure();
return path;
}