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. C#
  4. Draw railway using Graphics GDI+

Draw railway using Graphics GDI+

Scheduled Pinned Locked Moved C#
graphicswinformsdata-structuresregexhelp
6 Posts 3 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.
  • B Offline
    B Offline
    baranils
    wrote on last edited by
    #1

    Hello I'm trying to find some idea / method to draw railway pattern using Graphics gdi+ Google map gives a example to do some, I do not need to do exactly the same but something that can looks like a railway The source information is an array of PointF I'd a look on Pen.CompoundArray but I do not understand how it works from an atrray of PointF Thanks for any help / suggestion

    C M 2 Replies Last reply
    0
    • B baranils

      Hello I'm trying to find some idea / method to draw railway pattern using Graphics gdi+ Google map gives a example to do some, I do not need to do exactly the same but something that can looks like a railway The source information is an array of PointF I'd a look on Pen.CompoundArray but I do not understand how it works from an atrray of PointF Thanks for any help / suggestion

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You mean a railway track ? I guess you draw two lines next to each other, then you draw small lines across it. I would think the best way to do that, would be to create a brush that defines a piece of track, then use that to draw your line.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      B 1 Reply Last reply
      0
      • C Christian Graus

        You mean a railway track ? I guess you draw two lines next to each other, then you draw small lines across it. I would think the best way to do that, would be to create a brush that defines a piece of track, then use that to draw your line.

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

        B Offline
        B Offline
        baranils
        wrote on last edited by
        #3

        guess you draw two lines next to each other, then you draw small lines across it.

        This is the obvious "brute force" way : needs a lot of calculation awikll fatten the code I really do not want to use that way

        I would think the best way to do that, would be to create a brush that defines a piece of track, then use that to draw your line.

        I also think that it will be a good way but I do not know how to define the brush ? Do I have to create an external image ?

        C 1 Reply Last reply
        0
        • B baranils

          guess you draw two lines next to each other, then you draw small lines across it.

          This is the obvious "brute force" way : needs a lot of calculation awikll fatten the code I really do not want to use that way

          I would think the best way to do that, would be to create a brush that defines a piece of track, then use that to draw your line.

          I also think that it will be a good way but I do not know how to define the brush ? Do I have to create an external image ?

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          baranils wrote:

          I also think that it will be a good way but I do not know how to define the brush ?

          You create a brush from a Bitmap, so you can load that from a file, or just draw it. In fact, I think the class you want is called BitmapBrush

          Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

          1 Reply Last reply
          0
          • B baranils

            Hello I'm trying to find some idea / method to draw railway pattern using Graphics gdi+ Google map gives a example to do some, I do not need to do exactly the same but something that can looks like a railway The source information is an array of PointF I'd a look on Pen.CompoundArray but I do not understand how it works from an atrray of PointF Thanks for any help / suggestion

            M Offline
            M Offline
            Mark Churchill
            wrote on last edited by
            #5

            You'll probably have to draw over the line twice. Read up on the compoundarray to get it to draw a double line (your railway lines). Then draw over that with a thick line and custom dash style to get sleepers.

            Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
            Entanglar: .Net game engine featuring automatic networking and powerful HLSL gfx binding.

            B 1 Reply Last reply
            0
            • M Mark Churchill

              You'll probably have to draw over the line twice. Read up on the compoundarray to get it to draw a double line (your railway lines). Then draw over that with a thick line and custom dash style to get sleepers.

              Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
              Entanglar: .Net game engine featuring automatic networking and powerful HLSL gfx binding.

              B Offline
              B Offline
              baranils
              wrote on last edited by
              #6

              Thank you I will investigate that way !

              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