• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 5 رای - 3.6 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: قراردادن متن بر روی عکس ( Watermark)
حالت موضوعی
#1
ابتدا با دستور زیر عک عکس را لود می کنیم
کد:
string fileloc = oFileDlg.FileName;

//load image to picturebox

pictureBox1.Image = Image.FromFile(fileloc);
سپس کد زیر را در یک رویداد قرار می دهیم
کد:
if (pictureBox1.Image != null)

{

    // Create image.

    Image tmp = pictureBox1.Image;

    // Create graphics object for alteration.

    Graphics g = Graphics.FromImage(tmp);



    // Create string to draw.

    String wmString = "Mdi Sample";

    // Create font and brush.

    Font wmFont = new Font("Trebuchet MS", 10);

    SolidBrush wmBrush = new SolidBrush(Color.White);

    // Create point for upper-left corner of drawing.

    PointF wmPoint = new PointF(10.0F, 10.0F);

    // Draw string to image.

    g.DrawString(wmString, wmFont, wmBrush, wmPoint);

    //Load the new image to picturebox                

    pictureBox1.Image = tmp;

    // Release graphics object.

    g.Dispose();

}
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  کمک برای اموزش قراردادن افرادانلاین درasp.net 2khtarepaeezi 1 3,084 07-27-2014، 10:39 AM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 1 مهمان