Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. 2D Line (XNA)

2D Line (XNA)

Scheduled Pinned Locked Moved Graphics
questionhelptutoriallearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MasterSharp
    wrote on last edited by
    #1

    Hello. It may seem like a beginner question, but I'd like to know how to draw a line. Simple? I've been looking all over the net, and through these books I have, (also CodeProject) and nothing "works". Please help, thanks in advance.

    - I love D-flat!

    L 1 Reply Last reply
    0
    • M MasterSharp

      Hello. It may seem like a beginner question, but I'd like to know how to draw a line. Simple? I've been looking all over the net, and through these books I have, (also CodeProject) and nothing "works". Please help, thanks in advance.

      - I love D-flat!

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, for the Form, Panel, or whatever Control you want to draw on, use the OnPaint handler (or add a new handler to the Paint event); it will give you a PaintEventArgs offering a Graphics object, then use Graphics.DrawLine() and the like. If you need examples, there are plenty around at CP. My Sokoban article also has some line drawing. [ADDED] just noticed some essential info got hidden in the subject line; for XNA things are a bit more complicated, but they do provide some documentation, so this may help[^]. [/ADDED] :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


      modified on Sunday, January 13, 2008 5:03:32 PM

      M 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, for the Form, Panel, or whatever Control you want to draw on, use the OnPaint handler (or add a new handler to the Paint event); it will give you a PaintEventArgs offering a Graphics object, then use Graphics.DrawLine() and the like. If you need examples, there are plenty around at CP. My Sokoban article also has some line drawing. [ADDED] just noticed some essential info got hidden in the subject line; for XNA things are a bit more complicated, but they do provide some documentation, so this may help[^]. [/ADDED] :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


        modified on Sunday, January 13, 2008 5:03:32 PM

        M Offline
        M Offline
        MasterSharp
        wrote on last edited by
        #3

        Oh, I know how to draw lines there. That's easy. BUT, in XNA, it's a whole new territory. To your added reply, I've seen that, and tried, but wasn't sure what type the variables were when previously declared (they didn't show it there). Example: points? (My bad, I had pointList; it was points)

        - I love D-flat!

        modified on Sunday, January 13, 2008 5:10:42 PM

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups