L
Lou
I have a picture box with an image loaded into it from an Image list (Its a
solid Black Image).
Next I draw some lines into the picture box.
The resulting image with the lines is NOT the return value of
PictureBox1.Image????
In the exapmle below control "D" shows only the picture(Black Image) without
the lines I added using the brush?
The Picturebox shows the lines nicely but the lines don't seem to be part of
the controls "Inage" property.
How can I get the lines into my control "D"
-Lou
'Draw lines in the picturebox
'==========================================
Dim m_Brush As Brush
Dim myGraphics As Graphics
Dim m_Color1 As Color = Color.Blue
' Create a solid brush based on selected color
Dim mySolidBrush As New SolidBrush(m_Color1)
' Set m_Brush equal to the newly created brush
m_Brush = mySolidBrush
Dim myPen As New Pen(m_Brush, 2)
' Use the brush to draw the appropriate Drawing in the PictureBox1
myGraphics = PictureBox1.CreateGraphics()
' draw the safe title
myGraphics.DrawLine(myPen, 10, 0, 10, PictureBox1.Height)
myGraphics.DrawLine(myPen, 0, 10, PictureBox1.Width, 10)
myGraphics.DrawLine(myPen, PictureBox1.Width - 10, 0, PictureBox1.Width -
10, PictureBox1.Height)
myGraphics.DrawLine(myPen, 0, PictureBox1.Height - 10, PictureBox1.Width,
PictureBox1.Height - 10)
'===========================================
D.Picture = PictureBox1.Image
solid Black Image).
Next I draw some lines into the picture box.
The resulting image with the lines is NOT the return value of
PictureBox1.Image????
In the exapmle below control "D" shows only the picture(Black Image) without
the lines I added using the brush?
The Picturebox shows the lines nicely but the lines don't seem to be part of
the controls "Inage" property.
How can I get the lines into my control "D"
-Lou
'Draw lines in the picturebox
'==========================================
Dim m_Brush As Brush
Dim myGraphics As Graphics
Dim m_Color1 As Color = Color.Blue
' Create a solid brush based on selected color
Dim mySolidBrush As New SolidBrush(m_Color1)
' Set m_Brush equal to the newly created brush
m_Brush = mySolidBrush
Dim myPen As New Pen(m_Brush, 2)
' Use the brush to draw the appropriate Drawing in the PictureBox1
myGraphics = PictureBox1.CreateGraphics()
' draw the safe title
myGraphics.DrawLine(myPen, 10, 0, 10, PictureBox1.Height)
myGraphics.DrawLine(myPen, 0, 10, PictureBox1.Width, 10)
myGraphics.DrawLine(myPen, PictureBox1.Width - 10, 0, PictureBox1.Width -
10, PictureBox1.Height)
myGraphics.DrawLine(myPen, 0, PictureBox1.Height - 10, PictureBox1.Width,
PictureBox1.Height - 10)
'===========================================
D.Picture = PictureBox1.Image