Community of VE/MapPoint Users and Developers
This is a discussion on Numbers vs. Pushpins within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I am trying to link approx. 50 addresses from excel to 2006 mapoint. I am able to do this by ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Numbers vs. Pushpins Any help would be greatly appreciated. Thank you. |
| |||
| Re: Numbers vs. Pushpins
I have read that there are some text to .bmp tools on the web. If we assume that you could create .bmp of numbers 1 - 50, you could import them in as custom push pins. You would then do 50 imports of one address with each import and assign the .bmp of the corresponding number. This would be very tedious, but it is the only way I can think to do it with my somewhat limited MP experience. Hopefully someone else will have a much slicker way to accomplish the task. Michael Clow |
| |||
| Re: Numbers vs. Pushpins
Do you want the pushpin symbols to be number symbols or do you want a number in place of the name field in the balloon? There are 1 - 50 numbered symbols in mp2006 or like mdclow suggests, make some and import your own. If you are doing this with code the solution is fairly simple once you make your custom symbols. need a bit more info from you.
__________________ --Mel |
| |||
| Re: Numbers vs. Pushpins
Here's a rudimentary block of code to create numbered bitmap symbols to files which you can later import into mappoint. Create a windows forms application, and add pb1 - PictureBox control, 32x32 pixels ckToFiles - checkbox cboBGColor - combobox with value "Black" cboForeColor - combobox with value "White" cboSize - combobox with value "32x32" btnGenerate - command button Code:
Private gpText As System.Drawing.Drawing2D.GraphicsPath 'used to draw text
Dim ffText As New FontFamily("Arial")
Private Sub pb1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles pb1.Paint
If cboBGColor.SelectedIndex < 0 Then Exit Sub
If cboForeColor.SelectedIndex < 0 Then Exit Sub
Try
'draw the symbol outline ellipse
Dim colorBG As Color = Color.FromKnownColor(cboBGColor.SelectedItem)
Dim brushBG As New System.Drawing.SolidBrush(colorBG)
e.Graphics.FillEllipse(brushBG, 0, 0, 32, 32)
'draw the text
If Not (gpText Is Nothing) Then
Dim colorFG As Color = Color.FromKnownColor(cboForeColor.SelectedItem)
Debug.WriteLine("Forecolor: " & colorFG.R.ToString & "," & colorFG.G.ToString & "," & colorFG.Black.ToString)
e.Graphics.DrawPath(New Pen(colorFG), gpText)
Dim b As New System.Drawing.SolidBrush(colorFG)
e.Graphics.FillPath(b, gpText)
End If
Catch ex As Exception
Debug.WriteLine("ERROR IN PAINT()" & ControlChars.CrLf & " " & ex.Message)
End Try
End Sub
Private Sub DrawSymbol(ByVal i As Integer)
Dim ofsX As Integer
If i < 1000 Then ofsX = 3
If i < 100 Then ofsX = 8
If i < 10 Then ofsX = 13
gpText = New System.Drawing.Drawing2D.GraphicsPath(Drawing2D.FillMode.Winding)
gpText.AddString(i.ToString, ffText, FontStyle.Regular, 14, New Point(ofsX, 8), System.Drawing.StringFormat.GenericTypographic)
pb1.Refresh() 'force a PAINT event, thereby redrawing the bitmap
gpText.Dispose()
End Sub
Private Sub btnGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click
If Not ckToFiles.Checked Then
DrawSymbol(CInt(txtSample.Text))
Exit Sub
End If
For i As Integer = 0 To CInt(txtSample.Text)
DrawSymbol(i)
Dim bm As Bitmap = GetDecoratedImage(pb1)
Dim fn As String = "c:\temp\mappoint additional symbols\"
fn &= cboForeColor.Text & " on " & cboBGColor.Text & " " & cboSize.Text & " "
bm.Save(fn & i.ToString & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp)
Next
End Sub
Private Const SRCCOPY As Integer = &HCC0020
Private Declare Auto Function BitBlt Lib "gdi32.dll" (ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Boolean
Private Declare Auto Function GetWindowDC Lib "user32.dll" (ByVal hWnd As IntPtr) As IntPtr
Private Function GetDecoratedImage(ByRef Obj As Object) As Bitmap
'Get an image of a form object plus its decoration (borders, title bar, lines, etc)
'Get this object's Graphics object
Dim me_gr As Graphics = Obj.CreateGraphics
' Make a Bitmap to hold the ICON image
Dim bm As New Bitmap(32, 32, 96, Imaging.PixelFormat.Format24bppRgb, IntPtr.Zero)
Dim bm_gr As Graphics = me_gr.FromImage(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc
'Get the object's hDC. We must do this AFTER creating the new Bitmap
Dim me_hdc As IntPtr = GetWindowDC(Obj.Handle)
'BitBlt the object's image into the new Bitmap
BitBlt(bm_hdc, 0, 0, Me.Width, Me.Height, me_hdc, 0, 0, SRCCOPY)
'cleanup
bm_gr.ReleaseHdc(bm_hdc)
me_gr.Dispose()
bm_gr.Dispose()
Return bm
End Function
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'set values for our comboboxes
'Get all the values from the KnownColor enumeration
Dim colorsArray As System.Array = [Enum].GetValues(GetType(KnownColor))
Dim allColors(colorsArray.Length) As KnownColor
Array.Copy(colorsArray, allColors, colorsArray.Length)
For i As Integer = 0 To allColors.Length - 1
cboBGColor.Items.Add(allColors(i))
cboForeColor.Items.Add(allColors(i))
Next i
cboBGColor.SelectedItem = "White"
cboForeColor.SelectedItem = "Black"
cboSize.SelectedItem = "32x32"
cboSize.Text = "32x32"
End Sub
HTH Paul Last edited by Paul Larson; 03-31-2007 at 07:16 PM. |
| |||
| Re: Numbers vs. Pushpins
The only drawback of this concept is that writing and reading bmp-files from disk is slow and timeconsuming. Even if you do this with RAMDISK, somehow Mappoint needs a lot of cpu to plot a bitmap on the map. ( But I've used the same filename, maybe that's the cause. I'll try with a unigue name, you'll hear it from me soon.) |
| |||
| Re: Numbers vs. Pushpins
You could keep it simple and create a data file. Name 1 would be your number, Name 2 would be your address and have an identical address field for addresses. With the balloon option, you can show Name 1 and Name 2. Name 1 would be your number 1 - 50. Could get crowded but it is a rather simple way of getting what you wanted done. |
![]() |
| Tags |
| numbers, pushpins |
| ||||
| Posted By | For | Type | Date | |
| Using MapPoint and Excel for Supply Chain Management - MapPoint Articles - MP2K Magazine | This thread | Refback | 04-11-2007 12:59 AM | |
| An API to Control MapPoint 2006 GPS Features - Part I of II - MapPoint Articles - MP2K Magazine | This thread | Refback | 04-10-2007 11:39 PM | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 03-30-2007 10:32 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Total numbers of records/pushpins in dataset. | VC_Man | MapPoint 2006/2009 Discussion | 2 | 12-20-2006 03:43 AM |
| Highway numbers | Anonymous | MapPoint 2006/2009 Discussion | 1 | 06-23-2004 11:09 PM |
| Address Numbers | Anonymous | MapPoint 2006/2009 Discussion | 1 | 01-31-2003 11:44 AM |
| Freeway Exit Numbers | Anonymous | MapPoint 2006/2009 Discussion | 0 | 10-24-2002 03:43 PM |
| hi, i want to be able to put numbers in the plott.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 06-27-2002 09:45 AM |