PDA

View Full Version : نوشتن درون PictureBox



mojtaba_e
پنج شنبه 25 شهریور 1389, 10:40 صبح
سلام به همه دوستان
می خواستم بدونم با چه کدی میشه داخل یک عکسی که درون PictureBox هستش بنویسم و بعد این عکس را با همون نوشته بشه ذخیره کرد
مثل نرم افزار های گرافیکی

fjm11100
پنج شنبه 25 شهریور 1389, 10:56 صبح
میتونی فونت را به عکس تبدیل کنی خواستی کدش را میدم اما picturebox خیلی برای این کارا جالب نیست اگر حوصله کد نویسی نداری از gdpicture استفاده کن

s.khoshfekran
پنج شنبه 25 شهریور 1389, 11:40 صبح
اول تو یه Bitmap بریز تغییرات رو اونجا بده .اینجوری بهتره!!

mojtaba_e
پنج شنبه 25 شهریور 1389, 11:57 صبح
با تشکر
میشه درباره تبدیل فونت به عکس برام توضیح بدی و کدشو برام بذاری
gdpicture چی هست کامپوننته؟

s.khoshfekran
پنج شنبه 25 شهریور 1389, 12:09 عصر
از متد DrawString() استفاده کنید!

arefba
پنج شنبه 25 شهریور 1389, 14:37 عصر
اینم یه نمونه

private void Write()
{
pictureBox1.Image.Dispose();
System.IO.FileInfo fi = new System.IO.FileInfo(@"c:\Image.jpg");
if (fi.Exists)
fi.Delete();
Bitmap bim = new Bitmap(Library .Properties .Resources .SodoreKarteOzviat);
Graphics graphicImage = Graphics.FromImage(bim);
graphicImage.DrawString(txtIdMember .Text , new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(150, 70));
graphicImage.DrawString(txtName .Text , new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(250, 115));
graphicImage.DrawString(txtFamily .Text , new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(235, 150));
graphicImage.DrawString(txtDateMember .Text , new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(240, 185));
graphicImage.DrawString(txtfatherName .Text , new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(90, 147));
graphicImage.DrawString(txtJensiat .Text , new Font("Arial", 12, FontStyle.Bold), SystemBrushes.WindowText, new Point(90, 185));
bim.Save(@"c:\Image.jpg");
graphicImage.Dispose();
bim.Dispose();
}

بای