我是想在winform中作出那种样子的按钮,ps只能做图片吧

解决方案 »

  1.   

    图片做出来了
    button不是有相关图片属性吗?
    应该可以实现吧?
      

  2.   

    下面是我做的一段代码,但画出的图形有问题,请大家帮忙看看
    Point[] pt = new Point[128*4];
    int  x, y,c=0;
    Color pre=Color.FromArgb(204,204,204),curr; Bitmap image = (Bitmap)Image.FromFile(@"11.bmp"); for (y = 0; y < image.Height; y++)
    {
    for (x = 0; x < image.Width; x++)
    {
    curr=image.GetPixel(x, y);
    if (curr.ToArgb() != Color.FromArgb(204,204,204).ToArgb())
    {
    if(pre.ToArgb()==Color.FromArgb(204,204,204).ToArgb())
    {
    pt[c].X = x ;
    pt[c].Y = y;
    c++;
    }
    }
    else
    {
    if( pre.ToArgb()!=Color.FromArgb(204,204,204).ToArgb())
    {
    pt[c].X = x-1 ;
    pt[c].Y = y;
    c++;
    }
    }
    pre=curr;
    }
    } Point tmp=new Point(0,0);
    int count=0; 

    for(int i=0;i<pt.Length;i++)
    {
    if(pt[i]==tmp)
    {
    count=i;
    break;
    }
    } Point[] newpt=new Point[count];
    for(int k=0;k<count;k++)
    {
    newpt[k]=pt[k];
    }
    System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
    gp.AddPolygon(newpt);
    CustomButton.Region = new Region(gp);