MapWindow Home
Search MapWindow.org


  • Home
    • Download
    • Why MW
    • FAQ
    • Contact
  • Products
    • MapWindow
    • ActiveX
    • Plug-ins
  • Software Dev
    • Sample Code
    • Scripts
    • Source
    • Bugs
    • Support
    • Languages
  • Site Tools
    • Forums
    • Tutorials
    • Mailing Lists
    • Team
    • Site Stats
    • Links
  • Get Stuff
    • Buy a CD
    • Buy a T-Shirt
    • MW Book
    • ActiveX Book
    • Donate
    • Buy Support
  • Documentation
    • MWGIS App. User Guide
    • GISTools User Guide
    • MW Plug-ins Dev. Guide
    • MWGIS ActiveX Dev. Guide
    • MWGeoProc Dev. Guide

MapWinGIS:AxMap DrawLine

From MapWindow GIS

Jump to: navigation, search

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://www.mapwindow.org/wiki/index.php/MapWinGIS:AxMap_DrawLine"
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in / create account
  • What links here
  • Related changes
  • Upload file
  • Special pages
  • Printable version
  • Permanent link

Geospatial Software Lab

Copyright © 2008 - MapWindow Open Source Team
( last updated: December 03 2008.)
Home | Donate | Download | MapWindow GIS Desktop | MapWinGIS.ocx | Plug-ins | Contact | Lists | Bugs | Sample Code | Documentation
Code Repository | Open Source License | Discussion Forum | Wiki | Join the Team | Site Statistics | Links