动态画椭圆
public static void CreateEllipsePic(int intWidth, int intHeight, int intCornerHeight, int intCornerTopLeftWidth, int intCornerTopRightWidth, int intCornerBottomLeftWidth, int intCornerBottomRightWidth, Color BgColor, Color color, string strPath)
{
Bitmap bitmap = new Bitmap(intWidth, intHeight);
Graphics g = Graphics.FromImage(bitmap);
SolidBrush sb;// = new SolidBrush(BgColor);
Rectangle rect;// = new Rectangle(0, 0, intWidth, intHeight);
//g.FillRectangle(sb, rect);
int intRealRectHeight = intHeight - intCornerHeight * 2 + 1;
if (intRealRectHeight > 0)
{
sb = new SolidBrush(color);
rect = new Rectangle(0, intCornerHeight, intWidth, intRealRectHeight);
g.FillRectangle(sb, rect);
}
int intBegin, intEnd;
int j;
int varPrama = 2;
int intTempHeight = intCornerHeight - 1, intTempHeight1;
for (int i = 0; i <= intCornerHeight; i++)
{
intBegin = intCornerTopLeftWidth - varPrama;
if (intBegin < 0) intBegin = 0;
intEnd = intWidth - intCornerTopRightWidth + varPrama;
if (intEnd > intWidth) intEnd = intWidth;
for (j = intBegin; j < intEnd; j++)
{
bitmap.SetPixel(j, i, color);
}
if (i == 0 || i == intTempHeight)
{
varPrama = varPrama + 2;
}
else
{
varPrama = varPrama + 1;
}
}
varPrama = 2;
intTempHeight = intHeight - 1;
intTempHeight1 = intHeight - intCornerHeight + 1;
for (int i = intHeight - 1; i >= intHeight - intCornerHeight; i--)
{
intBegin = intCornerBottomLeftWidth - varPrama;
if (intBegin < 0) intBegin = 0;
intEnd = intWidth - intCornerBottomRightWidth + varPrama;
if (intEnd > intWidth) intEnd = intWidth;
for (j = intBegin; j < intEnd; j++)
{
bitmap.SetPixel(j, i, color);
}
if (i == intTempHeight || i == intTempHeight1)
{
varPrama = varPrama + 2;
}
else
{
varPrama = varPrama + 1;
}
}
bitmap.Save(strPath);
g.Dispose();
bitmap.Dispose();
}