0

hi,
i have this function..

Sub DrawScreen(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        Dim myPen As Pen
        myPen = New Pen(Color.Blue, 2)
        Dim gr As System.Drawing.Graphics = e.Graphics
        gr.DrawRectangle(myPen, 1 + x + (i * 4), y + (j * 4), 1 + x + (i * 4) + 3, y + (j * 4) + 3)
        Timer1.Start()
    End Sub

and i have to call it like this DrawScreen() from another function but the comipler is throwing error like this..

Error: Argument not specified for parameter 'e' of 'Public Sub DrawScreen(sender As Object, e As System.Windows.Forms.PaintEventArgs).

so please help me in making above function argument less... or tell me the way to call this function with arguments??????????

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Luc001
0

Hi,

I've made some changes and values to test your function.
Here's the result:

Public Class Form1
    Dim x As Integer = 50
    Dim i As Integer = 4
    Dim y As Integer
    Dim j As Integer = 10

    Sub DrawScreen()
        Dim gr As System.Drawing.Graphics = Me.CreateGraphics
        Dim myPen As New Pen(Color.Blue, 2)
        gr.DrawRectangle(myPen, (1 + x + (i * 4)), (y + (j * 4)), (1 + x + (i * 4) + 3), (y + (j * 4) + 3))
        Timer1.Start()

    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        DrawScreen()
    End Sub
End Class
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.