MapWinGIS:AxMap Resize

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

Resize

Resizes the map to the given width and height.


VB.NET Usage

Property Size() As System.Drawing.Size

            Parameters

ReturnValue

The size of the map returned as a System.Drawing.Size object. (Width and height can be accessed by using mySize.Width or mySize.Height.)

Sample Code

    Private Sub ResizeMap()
        Dim width As Integer, height As Integer
        Dim newSize As Size
        'Set the width and height to be used to resize map in pixels
        width = 200
        height = 200
        'Set newSize with new height and width values
        newSize.Width = width
        newSize.Height = height
        'Resize the map with the new width and height of newSize
        Map1.Size = newSize
    End Sub
  

VB 6 Usage
Sub Resize(Width As Long, Height As Long)
            Parameters

Width

The new width of the map control.
Height The new height of the map control.

Sample Code

    'This code is referenced from Microsoft Knowledge Base Article - 94927: How to Convert Twips to Pixels
    'http://support.microsoft.com/default.aspx?scid=kb;en-us;Q94927
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
    Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
    'This code is referenced from Microsoft Knowledge Base Article - 94927: How to Convert Twips to Pixels
    'http://support.microsoft.com/default.aspx?scid=kb;en-us;Q94927
    Private Function TwipsPerPixelX() As Single
        Dim lngDC As Long
        lngDC = GetDC(0)
        TwipsPerPixelX = 1440& / GetDeviceCaps(lngDC, 88)
        ReleaseDC 0, lngDC
    End Function
    'This code is referenced from Microsoft Knowledge Base Article - 94927: How to Convert Twips to Pixels
    'http://support.microsoft.com/default.aspx?scid=kb;en-us;Q94927
    Function TwipsPerPixelY() As Single
        Dim lngDC As Long
        lngDC = GetDC(0)
        TwipsPerPixelY = 1440& / GetDeviceCaps(lngDC, 90)
        ReleaseDC 0, lngDC
    End Function
    Private Sub ResizeMap()
        Dim width As Long, height As Long
        'Get the new width of the map in twips from 200 pixels
        width = TwipsPerPixelX() * 200
        'Get the new height of the map in twips from 200 pixels
        height = TwipsPerPixelY() * 200
        'Resize the map with the new width and height
        Map1.Resize width, height
    End Sub

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

This page has been accessed 1,723 times. This page was last modified on 9 November 2005, at 18:41.