вот так на картинку вписывается текст. public static void Pechat() { string FirstText = "привет Лолзтим, ты крут"; string[] array = FirstText.Split(' '); int counterOfWords = 0; float horizontal = 250; float verticalForChertej = 150; float horizontal1 = 260; float vertica1l = 135; float horizontal2 = 120; float vertical2 = 150; int x = 20; for (int i = 0; i < array.Length; i++) { counterOfWords++; } if (counterOfWords > 2) { int counter = 0; Image img = Bitmap.FromFile(@"D:\scriptscheats\sert.jpg"); for (int i = 0; i < counterOfWords; i++) { if (counter < 7) { ++counter; Graphics graph = Graphics.FromImage(img); graph.DrawString(array[i], new Font("MS Reference Sans Serif", (float)6.5), new SolidBrush(Color.Gray), horizontal1, vertica1l); horizontal1 += 35; graph = null; //img = null; } else { Graphics graph = Graphics.FromImage(img); graph.DrawString(array[i], new Font("MS Reference Sans Serif", (float)6.5), new SolidBrush(Color.Gray), horizontal2, vertical2); horizontal2 += 25; graph = null; } } img.Save(@"D:\scriptscheats\sert" + "1" + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); MessageBox.Show("Выполнено"); } else if (counterOfWords <= 2) { Image img = Bitmap.FromFile(@"D:\scriptscheats\sert.jpg"); for (int i = 0; i < counterOfWords; i++) { Graphics graph = Graphics.FromImage(img); graph.DrawString(array[i], new Font("MS Reference Sans Serif", (float)6.5), new SolidBrush(Color.Gray), horizontal1, vertica1l); horizontal1 += 25; graph = null; //img = null; MessageBox.Show("Выполнено"); } img.Save(@"D:\scriptscheats\sert" + "1" + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); } } Code public static void Pechat() { string FirstText = "привет Лолзтим, ты крут"; string[] array = FirstText.Split(' '); int counterOfWords = 0; float horizontal = 250; float verticalForChertej = 150; float horizontal1 = 260; float vertica1l = 135; float horizontal2 = 120; float vertical2 = 150; int x = 20; for (int i = 0; i < array.Length; i++) { counterOfWords++; } if (counterOfWords > 2) { int counter = 0; Image img = Bitmap.FromFile(@"D:\scriptscheats\sert.jpg"); for (int i = 0; i < counterOfWords; i++) { if (counter < 7) { ++counter; Graphics graph = Graphics.FromImage(img); graph.DrawString(array[i], new Font("MS Reference Sans Serif", (float)6.5), new SolidBrush(Color.Gray), horizontal1, vertica1l); horizontal1 += 35; graph = null; //img = null; } else { Graphics graph = Graphics.FromImage(img); graph.DrawString(array[i], new Font("MS Reference Sans Serif", (float)6.5), new SolidBrush(Color.Gray), horizontal2, vertical2); horizontal2 += 25; graph = null; } } img.Save(@"D:\scriptscheats\sert" + "1" + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); MessageBox.Show("Выполнено"); } else if (counterOfWords <= 2) { Image img = Bitmap.FromFile(@"D:\scriptscheats\sert.jpg"); for (int i = 0; i < counterOfWords; i++) { Graphics graph = Graphics.FromImage(img); graph.DrawString(array[i], new Font("MS Reference Sans Serif", (float)6.5), new SolidBrush(Color.Gray), horizontal1, vertica1l); horizontal1 += 25; graph = null; //img = null; MessageBox.Show("Выполнено"); } img.Save(@"D:\scriptscheats\sert" + "1" + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); } }
Minin_inactive4471240, Условие такого, что если в тесте больше 7 слов, то текст переносится на другую строчку смещением vertical += 25 The post was merged to previous Mar 12, 2022 Но текст всё равно по-дурацки пишется, хоть horizontal ставь 35
Чел, ты жжешь :) for (int i = 0; i < array.Length; i++) { counterOfWords++; } Code for (int i = 0; i < array.Length; i++) { counterOfWords++; }