Draw railway using Graphics GDI+
-
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
-
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
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 )
-
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 )
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 ?
-
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 ?
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 )
-
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
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. -
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.