做一个可改变大小的不规则窗体,具体要求如下:
1、窗体大小可以通过用户的鼠标操作进行改变
  【使用单个Btmp文件生成不规则窗体的方法就不适合了】
2、可以在显示器颜色深度的设置大于24 位时正常显示
  【通过简单的设置窗体的透明颜色的方法也被否定了】求高手相救?不胜感激

解决方案 »

  1.   

    一般来说不规则,只需要用到关键色
    相信这个很多地方都会说到如果你要做resize
    一般的话最简单的像MSN这样的
    RoundRectangle的话,简单做直接放在图片在后面,然后图片缩放就可以了
    但这样会有一个问题,圆角会被压扁
    所以讲究的话你需要采用九宫格的方法,分别在四个角贴4个小图片,其实只是一张的四个部分即可resize还是需要自己进行调整
    只要确保位置即可
      

  2.   

    24位以下可以通过Form的
    this.Region
    来解决战斗
      

  3.   

    如果圆角的话,this.Region = new Region(GraphicsHelper.getRoundedRect(this.ClientRectangle, 10));
    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;
    }