# AxMap user define

**URL:** <https://mapwindow.discourse.group/t/axmap-user-define/538>\
**Category:** MapWinGIS\
**Created:** [April 24, 2020, 11:47am UTC](https://mapwindow.discourse.group/t/axmap-user-define/538 "2020-04-24T11:47:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Bob](https://mapwindow.discourse.group/u/Bob)\
**Post date:** [April 24, 2020, 11:47am UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/1 "2020-04-24T11:47:58Z")

</div>

Hello,

Using OCX 5.1.1, I cannot find the following methods:

AxMap1.set\_UDPointImageListAdd  
AxMap1.set\_UDPointType

Is there a way around ?

Thanks

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [April 24, 2020, 4:03pm UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/2 "2020-04-24T16:03:45Z")

</div>

Hello Bob.

Many of the user-defined methods have been deprecated, but have been replaced by newer methods by which you can accomplish the same things, and perhaps more. The [online help file](https://www.mapwindow.org/documentation/mapwingis4.9/annotated.html) provides hints as to which methods you can use instead of the old ones.

For example, the UDPointFont… and UDPointType methods are now implemented by specifying [ShapeDrawingOptions.PointType](https://www.mapwindow.org/documentation/mapwingis4.9/class_shape_drawing_options.html#adda177063629f467d76defb70418aee4), following by other properties indicating [the Font, or the Picture](https://www.mapwindow.org/documentation/mapwingis4.9/_enumerations_8cs.html#a5fddbdd2f159d6da8808bfc871b99bc5), etc.

And The [ShapefileCategories](https://www.mapwindow.org/documentation/mapwingis4.9/class_shapefile_categories.html) allow for different images being drawn based on user-specified conditions.

Hope that helps.  
Jerry.

---

<div class="post-metadata">

**Author:** ![Bob](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Bob](https://mapwindow.discourse.group/u/Bob)\
**Post date:** [April 24, 2020, 5:57pm UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/3 "2020-04-24T17:57:37Z")

</div>

Thank you Jerry for your prompt reply, in the meantime I managed to plot my PNG icon to AxMap, in fact my problem was elsewhere in my code ([VB.net](http://VB.net) VS2019)  
Still I feel sorry to have to load all my PNG icons from file (to distribute along with the binary), I tried from ImageList or Resource, as shown below, of course this code do not work, but is there a way to do it ?  
Dim img As New Image  
img.Open(“C:\Users\icons\vehicle.png”, ImageType.USE\_FILE\_EXTENSION, True) ’ this works  
img.Open(My.Resources.vehicle.ToString, ImageType.BITMAP\_FILE, True) ’ This do not work of course

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [April 24, 2020, 7:57pm UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/4 "2020-04-24T19:57:08Z")

</div>

I understand.

Without an enhancement to the OCX, I see there is a method [Image.SetImageBitsDC,](https://www.mapwindow.org/documentation/mapwingis4.9/group __image__ data.html#gaa638a76c05424cd77540a44725110486) which loads an image from a Device Context. Could you possibly use this to load from a Resource, although it may take multiple steps?

---

<div class="post-metadata">

**Author:** ![Bob](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Bob](https://mapwindow.discourse.group/u/Bob)\
**Post date:** [April 25, 2020, 10:57am UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/5 "2020-04-25T10:57:54Z")

</div>

Hello Jerry,  
Ok I tried all day, could not find a way to cast from System.Drawing.Image to AxMap.Image, so I am always missing the file handle needed by AxMap.Image.SetImageBitsDC  
Guess I will have to keep my icons as file on disk… Until next OCX version.  
Thank you anyway.

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [April 25, 2020, 4:39pm UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/6 "2020-04-25T16:39:07Z")

</div>

Hello Bob. Sorry about your travails.

An AxMap.Image is a completely different type than System.Drawing.Image, so you would not be able to cast from one to the other. I believe the intent of the method is to do the conversion for you.

In the outside world (like .NET), you would get the hDC of a System.Drawing.Image, and pass that hDC into the OCX, and it would create an AxMap.Image using the hDC.

I admit that I have never tried this, but I believe it is the intent of this method. If I can find some time, I will try some things.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![Bob](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Bob](https://mapwindow.discourse.group/u/Bob)\
**Post date:** [April 25, 2020, 4:53pm UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/7 "2020-04-25T16:53:40Z")

</div>

Thank you  
My problems is 75% solved anyway, I managed to dump all icons to a public folder when starting my real time tracking app, from My.Ressource. So I don’t need to distribute them anymore, dumping to disk only the ones I need… and delete on exit.  
Stay safe,

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 5, 2022, 3:09pm UTC](https://mapwindow.discourse.group/t/axmap-user-define/538/8 "2022-01-05T15:09:01Z")

</div>

Closed on January 5, 2022, 3:09pm UTC


