///从找到的不透明点开始,继续寻找不透明点,一直到找到或则达到图片宽度
for (colNext = colOpaquePixel; colNext < bitmap.Width; colNext++)
if (bitmap.GetPixel(colNext, row) == colorTransparent)
break;
// Form a rectangle for line of opaque pixels found and add it to our graphics path
//将不透明点加到graphics path
graphicsPath.AddRectangle(new Rectangle(colOpaquePixel, row, colNext - colOpaquePixel, 1));
// No need to scan the line of opaque pixels just found
col = colNext;
}
}
}
// Return calculated graphics path
return graphicsPath;
}
}
4.运行
三、调用类库实现
主要就是根据一些坐标,然后根据这些坐标绘制窗体
代码如下:
-
public Form3()
{
-
InitializeComponent();
//创建不规则窗体
-
POINTAPI[] poin;
poin = new POINTAPI[5];
-
poin[0].x = 90;
poin[0].y = 90;
-
poin[1].x = this.Width;
poin[1].y = 0;
-
poin[2].x = Width;
poin[2].y = this.Height / 2;
-
poin[3].x = Width / 2;
poin[3].y = Height / 2;