Community of VE/MapPoint Users and Developers
This is a discussion on Pushpin symbol from in memory Bitmap within the Development forums, part of the MapPoint 2006/2009 Discussion category; How do I set a custom pushpin symbol from a in memory Bitmap image? I know that I can load ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Pushpin symbol from in memory Bitmap I know that I can load an image like this: Code: Symbol muSymbol = m_MapApp.ActiveMap.Symbols.Add("c:\myImage.bmp");
pin.Symbol = muSymbol.ID;
Code: Bitmap myBitmap = new Bitmap("c:\myImage.bmp");
Symbol muSymbol = m_MapApp.ActiveMap.Symbols.Add(myBitmap);
pin.Symbol = muSymbol.ID;
|
| |||
| Re: Pushpin symbol from in memory Bitmap
Hi, I think it has to be a disk file. Eventually you can speed up using a ram disk.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| ||||
| Re: Pushpin symbol from in memory Bitmap Quote:
Code: Bitmap myBitmap = new Bitmap("c:\myImage.bmp");
MemoryStream myStream = new MemoryStream();
myBitmap.Save(myStream, ImageFormat.bmp);
|
| |||
| Re: Pushpin symbol from in memory Bitmap
Hi, Maybe create a mapped file ? This is a file resident in memory. Normally windows API has same functions for all types of IO, so possible it works with mappoint as well. See http://msdn2.microsoft.com/en-us/lib...51(VS.85).aspx for some example. On the other hand I think it is much more simple to keep all bitmaps in resource of your application, save them to a real file, import in mappoint, and "I think" you can delete them afterwards (not sure).
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Pushpin symbol from in memory Bitmap
Did this just yesterday. My problem was that my bitmap was a 32 bit image (Bitmap bm) and the pushpins have to be 24 bit or smaller. I am tracking trailers, hence the notation of TrailerName. You use your own names, of course. So, that is the code that I have here .... Bitmapbitdump = newBitmap(bm.Width, bm.Height, PixelFormat.Format24bppRgb); for (intx = 0; x < bm.Width; x++) { for (inty = 0; y < bm.Height; y++) { Colorc = bm.GetPixel(x, y); bitdump.SetPixel(x, y, Color.FromArgb(c.R, c.G, c.B)); } } Stringpath = objMap.Parent.DefaultFilePath; bitdump.Save(path + "/" + TrailerName + ".bmp", ImageFormat.Bmp); MapPoint.Symbolsym = objMap.Symbols.Add(TrailerName + ".bmp"); MapPoint.Locationloc = objMap.GetLocation(Latitude, Longitude, 0); MapPoint.Pushpinpin = objMap.AddPushpin(loc, TrailerName); pin.Symbol = sym.ID; I create a new 24 bit bitmap and do the easy and long way to copy the bits from the source bitmap to my target. There may be a better way but I wanted to get the show going and didn't feel like reading and researching for something else. Anyway, having built the new bitmap, I found that it had to be saved in the MapPoint folder structure. That is the need for the path variable. Save the bitmap and re-read it into a symbol. Assign the symbol to the pushpin Dennis |
![]() |
| Tags |
| bitmap, memory, pushpin, symbol |
| ||||
| Posted By | For | Type | Date | |
| Snap to a Road - MapPoint Articles - MP2K Magazine | This thread | Refback | 03-17-2008 11:51 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [HELP] How to extract symbol bitmap from mappoint | phrozzy | MapPoint 2006/2009 Discussion | 0 | 06-21-2006 04:35 AM |
| [C#] MappointControl - Pushpin symbol | suamikim | MapPoint 2006/2009 Discussion | 4 | 11-23-2005 03:02 AM |
| Return Pushpin Symbol | Anonymous | MapPoint 2006/2009 Discussion | 1 | 04-27-2005 03:12 PM |
| set pushpin symbol | starbuck | MapPoint 2006/2009 Discussion | 3 | 10-19-2003 04:27 PM |
| Is there a way to use a different pushpin symbol w.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 08-01-2001 08:59 AM |