Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi there.

 

I try to look for this function in c# and cannot find line in pictureBox1!

 

Any idea what happen to it?

 

Any idea how to solve it?

 

Do i really need to use gdi or graphics to do it?

 

Any help... maybe some sample codes can help me...

 

Just say the vb6 code is like this

 

PictureBox1.Line(Paths.GetNode(i).X, Paths.GetNode(i).Z) - (Paths.GetNode(i + 1).X, Paths.GetNode(i + 1).Z), RGB(0, 0, 256)

 

How will do that exactly in c#?

 

Path.GetNode() is my own functions of geting x,y,z!

 

Thanks.

 

Regards,

Chua Wen CHing :p

Posted

Hmm.. maybe a sample of codes which i can imitate the arguments i use in c#!

 

I never code in gdi.. maybe some guides on code.. should be cool

 

thanks for the reply!

 

Regards,

Chua Wen Ching :p

  • *Experts*
Posted

You need to create graphics object for your control or use the one that is passed into Paint event or the OnPaint ovverride.

To use the one from Paint event do this:

//in your paint event
e.Graphics.DrawLine(new Pen(Color.Blue),100,100,200,200);
//first you specify the pen used to draw then coordinates

If you want to create the graphics object you do something like this:

Graphics gr = this.CreateGraphics();
gr.DrawLine(new Pen(Color.Blue),100,100,200,200);

Using the paint arguments from the paint event is required to get the maximum performance.

Posted

Hmmm...

 

thanks..

 

do i code that in Main(), i mean the 2nd code!

 

But based on:

 

PictureBox1.Line(Paths.GetNode(i).X, Paths.GetNode(i).Z) - (Paths.GetNode(i + 1).X, Paths.GetNode(i + 1).Z), RGB(0, 0, 256)

 

--> I need to use drawline and accepts the same argument like picturebox.line

 

Hmm.. anyway i will give it a try first! See what i can do with gdi power!

 

Thanks!

 

Regards,

Chua Wen Ching :p

  • *Experts*
Posted

Thats essentially what it accepts. First the pen, for which you specify the color, like the RGB argument for the Line Method.

Then the coordinates of the starting point of the line, same as first two in Line and then 2for ending point, again same as Line. Very similar.

Remeber that the second one will only draw it once, if the window needs to repaint you will have to call that method again.

Posted

Hmmm.. thanks anyway can you check out my other post on copy bitmap into memory or array...

 

i am waiting for someone to answer it..

 

maybe you are the right person..

 

Thanks.. i am looking into gdi!

 

Just wondering, when i render 3d in directx, should i use gdi+ or i better use everything on directx 8.1 or 9

 

what i mean can i integerate gdi into directx?

 

Thanks.

 

Regards,

Chua Wen Ching :p

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...