ScreenShot / Watermark
Posted: Thu Jun 17, 2010 9:44 pm
how can i make a program take a screenshot but have a watermark in it
Sharing, Teaching and Supporting coders of all ages and levels since 2009
https://www.codenstuff.com/forum/
Dim thisScreen As Rectangle = Screen.PrimaryScreen.Bounds
PictureBox1.Image = New Bitmap(thisScreen.Width, thisScreen.Height)
Dim gfx As Graphics = Graphics.FromImage(PictureBox1.Image)
gfx.CopyFromScreen(0, 0, 0, 0, PictureBox1.Image.Size) 'take the screenshot
Dim watermark As Bitmap = Bitmap.FromFile("watermark.png") 'load our watermark image
watermark.MakeTransparent(Color.White) 'choose this depending on your watermark background (optional)
Dim cm As ColorMatrix = New ColorMatrix()
cm.Matrix33 = 0.5F 'transparency level
Dim ia As ImageAttributes = New ImageAttributes()
ia.SetColorMatrix(cm)
'draw to top left
gfx.DrawImage(watermark, New Rectangle(0, 0, watermark.Width, watermark.Height), 0, 0, watermark.Width, watermark.Height, GraphicsUnit.Pixel, ia)
gfx.Dispose()
ia.Dispose()
watermark.Dispose()
PictureBox1.Refresh()
Lewis-Froom wrote:Mandai you are one genius you have helped me aswellI gotta agree! Mandai, is very helpful along with so many other users here!
your code does not workZachman
zachman61 wrote:i fixed it i forgot to use importslol, Thx for the code m8.
gfx.DrawImage(watermark, New Rectangle(PictureBox1.Image.Width - watermark.Width, PictureBox1.Image.Height - watermark.Height, watermark.Width, watermark.Height), 0, 0, watermark.Width, watermark.Height, GraphicsUnit.Pixel, ia)