hog Posted July 12, 2003 Posted July 12, 2003 I have a splash form with a photo in a picturebox. I want to draw text on this photo. I have tried using a label with the backcolor set to transparent but it still shows a background colour?? So I have tried this, but the text does not appear? Private Sub frmSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim gfxSreen As Graphics = Graphics.FromHwnd(Me.PictureBox1.Handle) gfxSreen.DrawString("AnyText", New Font("Comic Sans MS", 20), New SolidBrush(Color.Black), 5, 5) End Sub any ideas? Quote My website
*Experts* mutant Posted July 12, 2003 *Experts* Posted July 12, 2003 You are drawing it in form load, before the form and picture box are shown, and you draw it only once so it will not be there during the next repaint. Do this in the Paint event of your picture box. Quote
hog Posted July 12, 2003 Author Posted July 12, 2003 Nope...still doesn't work :( Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint Dim gfxSreen As Graphics = Graphics.FromHwnd(Me.PictureBox1.Handle) gfxSreen.DrawString("AntyText", New Font("Comic Sans MS", 20), New SolidBrush(Color.Black), 5, 5) End Sub Quote My website
*Experts* mutant Posted July 12, 2003 *Experts* Posted July 12, 2003 Dont create your own graphics object, use the "e" argument that passed into the Paint event, it contains the graphics object: Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint e.Graphics.DrawString("AntyText", New Font("Comic Sans MS", 20), New SolidBrush(Color.Black), 5, 5) End Sub Quote
hog Posted July 12, 2003 Author Posted July 12, 2003 Bugger:) I'd tried this but just used e.drawstring....oh so close:) Thnx Mutant Quote My website
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.