J
jasonfan2000
Guest
Hi,
I use Visual Basic .net 2017 to write a test program. In that program, I try to use subroutine from a module to draw text or graph but it seems to give me an error on LinearGradientBrush. Can somebody kindly help to solve this error and let me know?
Here is the code:
--------------------------------------------------------------------------------------------------
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
drawOutput()
End Sub
End Class
Imports System.Drawing.Drawing2D
Module Module1
Public Property ClientRectangle As PointF
Public Sub drawOutput()
Dim MyGraphics As Graphics = Form1.PictureBox1.CreateGraphics
Dim MyBrush As New LinearGradientBrush(ClientRectangle, Color.Red,
Color.Yellow, LinearGradientMode.Horizontal)
Dim MyBrush1 As New LinearGradientBrush(ClientRectangle, Color.Green,
Color.Blue, LinearGradientMode.Horizontal)
Dim MyFont As New Font("Arial", 10.5, FontStyle.Regular)
Dim MyFont1 As New Font("Cambria", 12, FontStyle.Regular)
MyGraphics.DrawString("This is Arial Font!", MyFont, MyBrush, 40, 40)
MyGraphics.DrawString("This is Cambria Font!!", MyFont1, MyBrush1, 40, 60)
End Sub
End Module
--------------------------------------------------------------------------------------------------------
I believe it should look really simple to someone who has some years of experience in vb.net unlike me.
Please help!!
Continue reading...
I use Visual Basic .net 2017 to write a test program. In that program, I try to use subroutine from a module to draw text or graph but it seems to give me an error on LinearGradientBrush. Can somebody kindly help to solve this error and let me know?
Here is the code:
--------------------------------------------------------------------------------------------------
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
drawOutput()
End Sub
End Class
Imports System.Drawing.Drawing2D
Module Module1
Public Property ClientRectangle As PointF
Public Sub drawOutput()
Dim MyGraphics As Graphics = Form1.PictureBox1.CreateGraphics
Dim MyBrush As New LinearGradientBrush(ClientRectangle, Color.Red,
Color.Yellow, LinearGradientMode.Horizontal)
Dim MyBrush1 As New LinearGradientBrush(ClientRectangle, Color.Green,
Color.Blue, LinearGradientMode.Horizontal)
Dim MyFont As New Font("Arial", 10.5, FontStyle.Regular)
Dim MyFont1 As New Font("Cambria", 12, FontStyle.Regular)
MyGraphics.DrawString("This is Arial Font!", MyFont, MyBrush, 40, 40)
MyGraphics.DrawString("This is Cambria Font!!", MyFont1, MyBrush1, 40, 60)
End Sub
End Module
--------------------------------------------------------------------------------------------------------
I believe it should look really simple to someone who has some years of experience in vb.net unlike me.
Please help!!
Continue reading...