Create an official seal using C #

Source: Internet
Author: User

Let's take a look at it first:

Code:
Private void button#click (Object sender, system. eventargs E)
{
Graphics G = This. creategraphics ();
G. Clear (color. White );
// G. interpolationmode = interpolationmode. highqualitybicubic;
G. compositingquality = compositingquality. highquality;
G. smoothingmode = smoothingmode. highquality;

Int radius = 200;
Circulartextuallayout CTL = new circulartextuallayout ();
CTL. radius = radius;
Point Location = new point (50, 20 );
// CTL. centerpoint = new point (location. x + radius, location. Y + radius );
CTL. textdrawing = "正 ";

Float arcangle = 270;
CTL. arcangle = arcangle;
CTL. anglestart =-arcangle/2 + arcangle/2/CTL. textdrawing. length;
CTL. textfontinner = new font (" 正 ", radius/3.2f );
CTL. ratiox = 0.6f;
CTL. borderwidth = (INT) (CTL. radius/40 );
// CTL. isbold = false;
CTL. Location = location;
CTL. wordscolor = color. fromargb (250, color. Red );
CTL. bordercolor = color. fromargb (250, color. Red );
CTL. rectcolor = color. fromargb (250, color. Red );
CTL. Draw (g );

G. Dispose ();
}

Watermark image in the official seal style ():

Private void button2_click (Object sender, system. eventargs E)
{
Graphics G = This. creategraphics ();
G. Clear (color. White );
// G. drawimage (image. fromfile (@ "F:/IMGs/girl/227.jpg"), 0, 0 );
G. drawimage (image. fromfile (@ "D:/johnsuntest/AA/05290_b11.jpg"), 0, 0 );
// G. interpolationmode = interpolationmode. highqualitybicubic;
G. compositingquality = compositingquality. highquality;
G. smoothingmode = smoothingmode. highquality;

Int radius = 100;
Int offset = 1;
Circulartextuallayout CTL = new circulartextuallayout ();
CTL. radius = radius;
Point Location = new point (500,100 );
// CTL. centerpoint = new point (location. x + radius, location. Y + radius );
CTL. textdrawing = "watermark image creation in the seal style ";

Float arcangle = 270;
// CTL. anglestart =-105 + 210/CTL. textdrawing. Length/2;
CTL. arcangle = arcangle;
// CTL. anglestart = (arcangle/2) * (-1 + 1/CTL. textdrawing. Length );
CTL. anglestart =-arcangle/2 + arcangle/2/CTL. textdrawing. length;
// CTL. textfontinner = new font (" 正 ", 56f );
CTL. textfontinner = new font (" 正 ", radius/3.2f );
CTL. ratiox = 0.6f;
CTL. borderwidth = (INT) (CTL. radius/40 );
// CTL. isbold = false;
CTL. Location = location;
CTL. wordscolor = color. fromargb (160, color. Black );
CTL. bordercolor = color. fromargb (160, color. Black );
CTL. rectcolor = color. fromargb (160, color. Black );
CTL. Draw (g );

Location. offset (-offset * 2,-offset * 2 );
CTL. Location = location;
CTL. wordscolor = color. fromargb (160, color. White );
CTL. bordercolor = color. fromargb (60, color. White );
CTL. rectcolor = color. fromargb (160, color. White );
CTL. Draw (g );

G. Dispose ();
}

Related links:
Use C # To create a seal (continued) http://blog.csdn.net/johnsuna/archive/2006/03/23/635989.aspx
Create a circular seal http://blog.csdn.net/johnsuna/archive/2007/10/12/1821531.aspx in WPF

Later WPF versions:
Article 2
Http://blog.csdn.net/johnsuna/archive/2008/04/28/2336495.aspx)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.