VB.Net - Show Image With Watermark

This snippet shows how to load an image with a simple water mark effect.
  1. Imports System.Drawing
  2. Imports System.Drawing.Drawing2D
  3.  
  4. Public Class Form1
  5.  
  6.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.  
  8.         Dim img As New Bitmap(PictureBox1.Image)
  9.         Dim g = Graphics.FromImage(img)
  10.         Dim sb As New SolidBrush(Color.FromArgb(70, 0, 0, 0))
  11.  
  12.         g.DrawString("Water Mark", New Font("Tahoma", 30, FontStyle.Bold), sb, 0, 0)
  13.         PictureBox1.Image = img
  14.  
  15.     End Sub
  16.  
  17. End Class

No comments:

Post a Comment