| private void Page_Load(object sender, System.EventArgs e) |
| { |
| // Create instance of PhotoSprite |
| Graphic MyGraphic = new PhotoSprite.Graphic(); |
| |
| // Original image name |
| MyGraphic.SourceFile = Server.MapPath( "images/demo.jpg" ); |
| // Destination image name, and can make the same as the original image name |
| MyGraphic.DestFile = Server.MapPath( "images/tmp/WaterText.jpg" ); |
| |
| // Set the font property |
| MyGraphic.FontFamily = "Arial"; |
| MyGraphic.FontSize = 24; |
| MyGraphic.FontColor = "#FF0000"; |
| |
| // Font weight: |
| // Bold, Italic, Strikeout, Underline, Regular |
| MyGraphic.FontWeight = System.Drawing.FontStyle.Bold; |
| |
| // The transparency of the font color, which between 0 and 255 |
| MyGraphic.ColorAlpha = 255; |
| |
| // Text style |
| // Default, Chiseled, Outline, Embossed |
| MyGraphic.TextStyle = PhotoSprite.Graphic.TextMode.Default; |
| |
| // Align mode: |
| // TopLeft, TopMid, TopRight, |
| // MidLeft, Center, MidRight, |
| // BottomLeft, BottomMid, BottomRight |
| MyGraphic.Align = PhotoSprite.Graphic.AlignMode.Center; |
| |
| // The X and Y coordinates of the text top left corner relative to the image |
| // Note: |
| // You must set MyGraphic.Align=PhotoSprite.Graphic.AlignMode.TopLeft |
| // if you want to make the X, Y property valid. |
| MyGraphic.X = 0; |
| MyGraphic.Y = 0; |
| |
| // The text on the image |
| string Text = "WWW.PHOTOSPRITE.NET"; |
| |
| // The direction of showing the text on the image |
| // true for horizontal, false for vertical |
| bool bIsHorz = true; |
| |
| // Drawing the water text |
| MyGraphic.WaterText( Text, bIsHorz ); |
| |
| |
| // Show the contrastive effect |
| SrcImage.Src = "images/demo.jpg"; |
| DstImage.Src = "images/tmp/WaterText.jpg"; |
| } |
|