Business needs to dynamically add text to the picture (the book's cover picture), modify the font size, font, color, control location
Test code:
1 String path = @ "E:\cover.png"; 2 3 Bitmap bmp = new Bitmap (path); 4 Graphics g = graphics.fromimage (BMP); 5 String str = "Yin Yu jing"; 6 Font font = new Font ("Imitation _gb2312", fontstyle.bold);//Set font, size, weight 7 solidbrush sbrush = new Sol Idbrush (Color.White);//Set color 8 int base_left = 10; 9 int left_space = 30;10 int base_top = 27;12 int top_space = 27;13 for (int i = 0; i < str.) Length; i++) {if (i >) + continue;18 g.DrawString (Str[i] + "", Font, Sbrush, new PointF (Base_left + (Left_space * 2), Base_top + (Top_space * (I-14)))) ;}20 else if (i > 6) {g.drawstring (Str[i] + "", Font, Sbrush, new PointF (Base_left + (Left_space * 1), Base_top + (Top_space * (i-7))); 23}24 Else25 {g.drawstring (Str[i] + "", Font, Sbrush, new PointF (base_l EFT, Base_top + (Top_space * i));}28}30//memorystream ms = new Memorys Tream ();//bmp. Save (MS, SYSTEM.DRAWING.IMAGING.IMAGEFORMAT.BMP), Bmp. Save (@ "E:\cover1.png");
Font selection:
Blackbody: Simhei
Song Body: SimSun
New song body: Nsimsun
Imitation: Fangsong
Italics: Kaiti
Imitation _gb2312:fangsong_gb2312
Italic _gb2312:kaiti_gb2312
Microsoft Elegance Blackbody: Microsoft Yahei
End.