Question Overlaying Text / translucent overview over a given picture

Something like this might work well:

VB.NET:
Using canvas As Graphics = Graphics.FromImage(yourImageHere)
      canvas.DrawString("String which is drawn", yourFontHere", 25, 25)
      canvas.DrawImage(yourOverlayImageHere, 0, 0)
End Using

Simply draw on the new image whatever you need there.

Bobby
 
I think Bobby meant to put those two graphics operations in the opposite order (first DrawImage and then DrawString).

I looked at the sample image to see what you meant by translucent. The darkened area at the top of the screen could be done like this: first draw the image, then draw a translucent black rectangle, then draw the text over it.
VB.NET:
Dim rect As New Rectangle(0, 0, yourImageHere.Width, 150)
Using brush As New Drawing2D.SolidBrush(Color.FromARGB(180, 0, 0, 0))
    Canvas.FillRectangle(brush, rect)
End Using
The alpha value of the brush (180 in my example) determines the transparency of the rectangle.

The dimmer text at the top right corner in the sample could be done two ways. You could draw that text first and draw the translucent rectangle over it. Alternatively you could make the letters themselves translucent (that's what I thought you wanted from the thread title). As IntelliSense will tell you, the DrawString statement also takes a Brush argument. You just define a transparent brush as above, and use that to draw the string.

cheers, Vic/BB
 
Back
Top