How to create a custom tkPointShapeType

Jul 22, 2011 at 2:51 AM
Edited Jul 22, 2011 at 2:53 AM

I need a sector of tkPointShapeType,but  tkPointShapeType enum is havn't  sector ;And I try use 

option.PointType = tkPointSymbolType.ptSymbolPicture;

option.Picture = img;

but  this picture have backColor of white;

I'm very vexed,anyone can help me?

My English is not good, please forgive;

Jul 22, 2011 at 2:52 AM
Edited Jul 22, 2011 at 3:33 AM

I use C#!Very Thanks!

Developer
Jul 22, 2011 at 5:02 PM

See Image class properties: Image.TransparencyColor, Image.TransparencyColor2, Image.UseTransparency.

Jul 24, 2011 at 2:42 PM
Edited Jul 24, 2011 at 2:46 PM
[$作者写道:
[$内容$]

Oh,Good,This issue is resolved,Very Thanks;But I encountered a new problem,

ShapeDrawingOptions option = new ShapeDrawingOptions();

option = sfPoint.DefaultDrawingOptions;

option.PointRotation = 60;

this PointRotation don't work;

Coordinator
Jul 25, 2011 at 2:17 PM

What doesn't work?

I'm using it in my application as well and it works good.

--
Paul

Jul 25, 2011 at 2:50 PM

I'm using the previous version,You can use the latest version has beenused;But  I think this map Does not provide draw point Shape Interface is a big Shortcoming;

Jan 2, 2012 at 5:59 PM

I hope you can help me as well.  I am new to programing and for this project we are using VS 2010.  The tutorial I have, is written by Brian Marchionni for VS2008.  I am using the latest stable version of the mapwinGIS.ocx v4.8 64bit and the .tkPointType.ptXX is not working none of the enumerations work for me.  I see that the tutorial is using old code (see below).  Could someone translate the C++ fix to .Net.  My code is below:

Private Sub loadCitiesShape()
        Dim myCitiesShape As New MapWinGIS.Shapefile
        myCitiesShape.Open("C:\Program Files\MapWindow\Sample Projects\World\Shapefiles\cities_capital_pt.shp")
        Dim hndCitiesShape As Integer
        hndCitiesShape = AxMap1.AddLayer(myCitiesShape, True)

        Dim pointColor As UInt32
        Dim pointSize As Single
        pointColor = Convert.ToUInt32(RGB(255, 100, 0))
        pointSize = 8.0

        AxMap1.set_ShapeLayerPointColor(hndCitiesShape, pointColor)
        AxMap1.set_ShapeLayerPointSize(hndCitiesShape, pointSize)
        AxMap1.set_ShapeLayerPointType(hndCitiesShape, MapWinGIS.tkPointType.ptUserDefined)

        Dim imgCities As New MapWinGIS.Image
        imgCities.Open("C:\Program Files\MapWindow\Styles\Icons\Tourism\smallcities.png", _
                       MapWinGIS.ImageType.PNG_FILE, True)

        AxMap1.set_UDPointType(hndCitiesShape, imgCities)

Jan 20, 2012 at 1:19 AM
Edited Jan 20, 2012 at 1:20 AM

Hi student_user100,

Replace the line AxMap1.set_UDPointType(hndCitiesShape, imgCities) with the following:

myCitiesShape.DefaultDrawingOptions.PointType = MapWinGIS.tkPointSymbolType.ptSymbolPicture
myCitiesShape.DefaultDrawingOptions.Picture = imgCities

Since you want to use Image as the symbol, you won't need to set the ShapeLayer properties.

 

Mar 20, 2012 at 10:28 PM
Edited Mar 20, 2012 at 10:54 PM

So I think I'm getting the hang of this but how do I use a picture object already on my form:

option.PointType = tkPointSymbolType.ptSymbolPicture;

option.Picture = picCar.Image; <---this is a picturebox control on my form, i don't load from a file.

Are the two types not compatible?

Also, how do I make the pint size bigger? Is PointSize not applied to the picture? the map will only display it with its original size? In the old MW I thought a picture symbol could be made bigger or smaller with a property?

And lastly TransparencyColor and TransparencyColor2 seems like you MUST set both if you have UseTransparencyColor = True. My picture has a white background and thought I will just set TransparencyColor to white but the picture does not display. As soon as I add TransparencyColor2 = white then it works. Is that intended behavior?

AGP