문자를 이미지로 파일로 변경해야 할 경우 사용해보세요.
//파라미터는 문자, 폰트이름, 폰트사이즈, 폰트스타일
private Bitmap Convert_Text_to_Image(string txt, string fontname, int fontsize, FontStyle fontStyle)
{
Bitmap bmp = new Bitmap(1, 1);
Graphics graphics = Graphics.FromImage(bmp);
Font font = new Font(fontname, fontsize, fontStyle);
SizeF stringSize = graphics.MeasureString(txt, font);
bmp = new Bitmap(bmp, (int)stringSize.Width, (int)stringSize.Height);
graphics = Graphics.FromImage(bmp);
graphics.DrawString(txt, font, Brushes.Black, 0, 0);
font.Dispose();
graphics.Flush();
graphics.Dispose();
return bmp;
}
'C#' 카테고리의 다른 글
[C#/PDA]Button의 텍스트 문자열 다중 출력 예제 (0) | 2016.01.18 |
---|---|
[C#]동호회 회원관리 프로그램 소개 (0) | 2016.01.15 |
[C#/PDA]PDA에서 실행 파일 경로 얻어오기 (0) | 2016.01.15 |
[C#/PDA]PDA에 장착된 카메라를 이용한 사진 촬영 예제 소스 (0) | 2016.01.15 |
[C#]pictureBox 동적 생성 예제 (0) | 2016.01.15 |