110,534
社区成员
发帖
与我相关
我的任务
分享
public bool SaveTextToGif(string strContent)
{
int height, wedth;
height = p_show.Height;
wedth = p_show.Width;
//Picture Size
System.Drawing.Bitmap bitMap = new System.Drawing.Bitmap(wedth, height);
System.Drawing.Graphics g = Graphics.FromImage(bitMap);
Color color = Color.FromArgb(0, Color.Transparent);
g.FillRectangle(new SolidBrush(color), new Rectangle(0,0,wedth,height));
Font stringFont = new Font("Arial", int.Parse(str_size));
SizeF stringSize = new SizeF();
stringSize = g.MeasureString(str_Info, stringFont);
//Background Color
g.Clear(System.Drawing.Color.Transparent);
//Output Text
for (int i = 0; i < tb_text.Text.Length; i++ )
{
//Set Text to White
if (i_color == 0)
{
g.DrawString(str_Info, new Font("Arail ", int.Parse(str_size), FontStyle.Regular), Brushes.White, new PointF(0, 0));
}
//Set Text to Black
if (i_color == 1)
{
g.DrawString(str_Info, new Font("Arail ", int.Parse(str_size), FontStyle.Regular), Brushes.Black, new PointF(0, 0));
}
//Set Text to Blue
if (i_color == 2)
{
g.DrawString(str_Info, new Font("Arail ", int.Parse(str_size), FontStyle.Regular), Brushes.Blue, new PointF(0, 0));
}
}
//Save Picture
bitMap.Save(str_File_Loca);
return true;
}
Bitmap bitMap = new Bitmap(wedth, height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
System.Drawing.Graphics g = Graphics.FromImage(bitMap);
System.Drawing.Bitmap bitMap = new System.Drawing.Bitmap(wedth, height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
System.Drawing.Graphics g = Graphics.FromImage(bitMap);