I am trying to draw a line on the Drawing layer. I have tried DrawLine and DrawLineEx but get the same error. - missing argument
Here is the code for DrawLine
Dim utils As New utils
Map1.DrawLine pnt1X, pnt1Y, pnt2X, pnt2Y, 5, utils.ColorByName(tkMapColor.Green)
I can draw a point fine using the following
Map1.DrawPoint pxX, pxY, 8, 0, True
Is anyway able to point me in the right direction.
Although not always necessary, I like to be deliberate about creating a new drawing layer, and you can tell it whether your coordinates are screen-based (screen pixels) or spatial reference based (coordinates in the Maps projection). And it returns a drawing layer handle (you can maintain more than 1).
Dim handle As Integer = Map1.NewDrawing(tkDrawReferenceList.dlSpatiallyReferencedList)
If it’s still not showing up, it may be a coordinate system issue, you can try using screen coordinates, and put the line at 100, 100, 200, 200. That should show up no matter what your coordinate system is.
WAIT. I just re-read your posting, and I know the problem. There is a new parameter added to the Draw functions that is not (yet) in the documentation. Someone recently added an Alpha (transparency) value after the drawing color. It has a default value (255) but perhaps the MS Access doesn’t handle the default parameters as it should.
Sorry for the misunderstanding, just try adding 255 after the color parameter, as
Thanks so much for this info. I did see that parameter on the intellisense but was not sure what it was. I tried 0 and 1 and it did not work. Your 255 works as does True. What exactly does this parameter do? And is it better to use True or 255
It is the Alpha value of the color, used to set Transparency. Colors defined by COM do not inherently support the Alpha (ARGB). They only support RGB values. So in order to support transparency, a number of functions have been modified to take an Alpha value that are used internally (using GDI+) to apply transparency.
So the valid range is 0 (fully transparent, which is why you didn’t see anything when you tried 0 and 1) up to 255 (fully opaque). I believe what’s happening with True is that the Variant Bool value for True is -1, which when applied to a unsigned single byte value is interpreted as 255, and presto.