Hi All:
I'm trying to draw text on a picture box. The image is a button. I'd tell you the color, but I'm slightly color blind (mostly). It is a shade of blue, a bit darker than cyan.
I got this code straight from the help. The way it is coded right now works, but I had to divide the locations in half to see it. When I take out the dividend, I see the outline of the rectangle around the button (which I don't want), but you can't see the text.
TP is a Tab Page.
I guess 3 things here:
A. I don't want to see the rectangle.
B. I need the text to be top in the Z-Order.
C. I want the text centered in the picture box.
If someone could steer me in the right direction, it would be greatly appreciated.
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
My newest novel: Wooden Warriors
I'm trying to draw text on a picture box. The image is a button. I'd tell you the color, but I'm slightly color blind (mostly). It is a shade of blue, a bit darker than cyan.
I got this code straight from the help. The way it is coded right now works, but I had to divide the locations in half to see it. When I take out the dividend, I see the outline of the rectangle around the button (which I don't want), but you can't see the text.
TP is a Tab Page.
Code:
Private Sub TP3_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles TP3.Paint
Dim Rect As New Rectangle[b][COLOR=blue](pbTests.Location.X / 2, pbTests.Location.Y / 2, pbTests.Width / 2, pbTests.Height / 2)[/color][/b]
Dim myText As String = "Test"
Dim solidBrush As New SolidBrush(Color.FromArgb(255, 0, 0, 255))
Dim fontFamily As New FontFamily("Arial")
Dim font As New Font( _
fontFamily, _
8, _
FontStyle.Regular, _
GraphicsUnit.Point)
e.Graphics.DrawString(myText, font, solidBrush, _
RectangleF.op_Implicit(Rect))
Dim pen As Pen = Pens.Black
e.Graphics.DrawRectangle(pen, Rect)
End Sub
I guess 3 things here:
A. I don't want to see the rectangle.
B. I need the text to be top in the Z-Order.
C. I want the text centered in the picture box.
If someone could steer me in the right direction, it would be greatly appreciated.
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
My newest novel: Wooden Warriors