MapWinGIS:AxMap DrawLine

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

DrawLine

Draws a line on the last drawing layer created using NewDrawing.
See also NewDrawing


VB.NET Usage

Sub DrawLine(x1 As Double, y1 As Double, x2 As Double, y2 As Double, pixelWidth As Integer, Color As System.UInt32)

            Parameters

x1

X coordinate of the first point used to draw the line.
y1 Y coordinate of the first point used to draw the line.
x2 X coordinate of the second point used to draw the line.
y2 Y coordinate of the second point used to draw the line.
pixelWidth Width of the line in pixels.
color Color to draw the line with. This is a UInt32 representation of an RGB value.

Sample Code

    Private Sub DrawLine()
        Dim draw_hndl As Integer, width As Integer
        Dim x1 As Double, y1 As Double, x2 As Double, y2 As Double
        'Set point 1 as x = 100, y = 100
        x1 = 100
        y1 = 100
        'Set point2 as x = 500, y = 500
        x2 = 500
        y2 = 500
        'Set pixel width for the line as 1
        width = 1
        'Create new drawing layer on map
        draw_hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
        'Draw green line from point 1 to point 2
        Map1.DrawLine(x1, y1, x2, y2, width, System.Convert.ToUInt32(RGB(0, 255, 0)))
    End Sub
  

VB 6 Usage
Sub DrawLine(x1 As Double, y1 As Double, x2 As Double, y2 As Double, pixelWidth As Long, Color As OLE_COLOR)
            Parameters

x1

X coordinate of the first point used to draw the line.
y1 Y coordinate of the first point used to draw the line.
x2 X coordinate of the second point used to draw the line.
y2 Y coordinate of the second point used to draw the line.
pixelWidth Width of the line in pixels.
color Color to draw the line with.

Sample Code

    Private Sub DrawLine()
        Dim draw_hndl As Long, width As Long
        Dim x1 As Double, y1 As Double, x2 As Double, y2 As Double
        Dim col As OLE_COLOR
        'Set point 1 as x = 100, y = 100
        x1 = 100
        y1 = 100
        'Set point2 as x = 500, y = 500
        x2 = 500
        y2 = 500
        'Set pixel width for the line as 1
        width = 1
        'Set the color for the line as green
        col = RGB(0, 255, 0)
        'Create new drawing layer on map
        draw_hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
        'Draw green line from point 1 to point 2
        Map1.DrawLine x1, y1, x2, y2, width, col
    End Sub

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:AxMap_DrawLine"

This page has been accessed 2,998 times. This page was last modified on 9 November 2005, at 18:42.