I'm making a front end to dvdauthor. I have a picturebox which holds the menu background. In order to draw a textbutton on the background image I store the image in a hidden picturebox. So the text doesn't get drawn to the visible background.
Code:
This works the first time. But if I hit save again it writes the text to the background image on pbMenu1.
Confused
Code:
VB.NET:
Dim ctl As Control
For Each c As Control In pbMenu1.Controls
If c.GetType() Is GetType(TextBtn) Then
ctl = c
Dim imgSize As New Bitmap(720, 480)
Dim imgGraphics As Graphics = Graphics.FromImage(bkgrndMenu1.BackgroundImage)
Dim btnFont As New Font(ctl.Font.Name, CInt(ctl.Font.Size))
Dim btnPoint As New PointF(CSng(ctl.Location.X.ToString), CSng(ctl.Location.Y.ToString))
Dim btnForeColor As New SolidBrush(ctl.ForeColor)
Dim btnBackColor As New SolidBrush(ctl.BackColor)
imgGraphics.FillRectangle(btnBackColor, 0, 0, bkgrndMenu1.Width, bkgrndMenu1.Height)
imgGraphics.DrawString(ctl.Text, btnFont, btnForeColor, btnPoint)
Else
MessageBox.Show("Your trying to burn a menu without buttons")
End If
Next
bkgrndMenu1.BackgroundImage.Save(Application.StartupPath & "background.png", ImageFormat.Png)
bkgrndMenu1.BackgroundImage = pbMenu1.BackgroundImage
Confused