i have this piece of code and i want it to be implemented in vb.net

Sub DrawScreen()
        If Picture1.Point(1 + x + (i * 4), y + (j * 4)) = RGB(c1, c2, c3) Then
            v(&HF) = 1
            Picture1.Line (1 + x + (i * 4), y + (j * 4))-(1 + x + (i * 4) + 3, y + (j * 4) + 3), RGB(0, 0, 0), BF
        Else
            Picture1.Line (1 + x + (i * 4), y + (j * 4))-(1 + x + (i * 4) + 3, y + (j * 4) + 3), RGB(c1, c2, c3), BF
        End If
End Sub

how to imlement this piece of code in vb.net... please i need code of it...urgent

Dear Agent-of-Chaos.

You need GDI API . Please visit msdn pages for System.Drawing classes.

thanks for your reply...
yes i know that i have to use GDI+.. so i have come up with this..

Public Sub Form1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs)
        Dim g As Graphics = e.Graphics
    End Sub

   
    Protected Sub DrawScreen(ByVal pe As PaintEventArgs)
        Dim pt1 As New Point(1 + x + (i * 4), y + (j * 4))
        Dim pt2 As New Point(1 + x + (i * 4) + 3, y + (j * 4) + 3)
        Dim RGB As New Point(0, 0)
        Dim g As Graphics = pe.Graphics
        Dim pn As New Pen(Color.Blue)
        g.DrawLine(pn, pt1 - pt2, RGB)
    End Sub 'OnPaint

now the problem is that RGB has three cordinates like RGB(0, 0 , 0), as Point can have only two cordinates poit(x,y) so i have force my self to make it RGB(0,0)... does it effect my code???? any solution of it???

the big problem is i have to call this function from other function which is called DrawSprite()..

sub drawSprite()
....
...
DrawScreen()

end sub

here i am calling it by having no argument passed in DrawScreen() function which generates error as i have declared arguments above in the function "ByVal pe As PaintEventArgs", so how i am going to call this function?????? pls reply quick i have only this day left...

and lastly how i am going to use "BF" in above code which is used for fillbox, wht is the alternative of it in vb.net???

please please reply.... or if you can give me organized code by ur self is going to be very helpful for... its just a piece of code u can share it, i am not asking for whole project:-(

Hi,
You mentioned:

the problem is that RGB has three cordinates like RGB(0, 0 , 0), as Point can have only two cordinates poit(x,y) so i have force my self to make it RGB(0,0)... does it effect my code????

Yes, It will affect your code with this error:

Value of type 'Integer' cannot be converted to 'System.Drawing.Color'.

So, That's not an option.

Hi,
You mentioned:


Yes, It will affect your code with this error:

So, That's not an option.

so whats an OPTION Respected sir????? how can i just convert 4 line of code to VB.Net??? please help me.. giv some code help..

Hi,

I think this could be useful.

Or this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.