做一个可改变大小的不规则窗体,具体要求如下:
1、窗体大小可以通过用户的鼠标操作进行改变
【使用单个Btmp文件生成不规则窗体的方法就不适合了】
2、可以在显示器颜色深度的设置大于24 位时正常显示
【通过简单的设置窗体的透明颜色的方法也被否定了】求高手相救?不胜感激
1、窗体大小可以通过用户的鼠标操作进行改变
【使用单个Btmp文件生成不规则窗体的方法就不适合了】
2、可以在显示器颜色深度的设置大于24 位时正常显示
【通过简单的设置窗体的透明颜色的方法也被否定了】求高手相救?不胜感激
解决方案 »
- 正则表达式来翻译下,我蒙了,在线等
- 如何在打包程序中实现客户填写信息
- c#的list<>泛型
- 问一个关系类型转换的小白问题
- 如何对某个文件夹下的文件重命名?
- 怎样获取数据库服务器上的文件目录!
- 求教!xml与treeview的问题
- 在C#中怎么能让bmp图片的其中一部分变成透明
- 请问怎样获得指定文件名文件的版本号(.net 2003 编译的exe文件)
- BitBlt函数问题???奇怪???谢了!
- 发现一个高人,给我发短信,并且一再强调自己是编程高手,精通unix,c,c++ 。 只要几天就能把C#学精。
- 如何解决HttpWebRequest将username和password用post方法提交到有验证码的目标网站?
相信这个很多地方都会说到如果你要做resize
一般的话最简单的像MSN这样的
RoundRectangle的话,简单做直接放在图片在后面,然后图片缩放就可以了
但这样会有一个问题,圆角会被压扁
所以讲究的话你需要采用九宫格的方法,分别在四个角贴4个小图片,其实只是一张的四个部分即可resize还是需要自己进行调整
只要确保位置即可
this.Region
来解决战斗
MORE DETAIL
static public GraphicsPath getRoundedRect(RectangleF baseRect, float radius) {
// if corner radius is less than or equal to zero,
// return the original rectangle
if (radius <= 0.0F) {
GraphicsPath mPath = new GraphicsPath();
mPath.AddRectangle(baseRect);
mPath.CloseFigure();
return mPath;
} // if the corner radius is greater than or equal to
// half the width, or height (whichever is shorter)
// then return a capsule instead of a lozenge
if (radius >= (Math.Min(baseRect.Width, baseRect.Height)) / 2.0)
return GetCapsule(baseRect); // create the arc for the rectangle sides and declare
// a graphics path object for the drawing
float diameter = radius * 2.0F;
SizeF sizeF = new SizeF(diameter, diameter);
RectangleF arc = new RectangleF(baseRect.Location, sizeF);
GraphicsPath path = new GraphicsPath(); // top left arc
path.AddArc(arc, 180, 90); // top right arc
arc.X = baseRect.Right - diameter;
path.AddArc(arc, 270, 90); // bottom right arc
arc.Y = baseRect.Bottom - diameter;
path.AddArc(arc, 0, 90); // bottom left arc
arc.X = baseRect.Left;
path.AddArc(arc, 90, 90); path.CloseFigure();
return path;
}