2

I have yet another problem..

Consider looking at THIS first..

on my early problems, I needed to drag a button, and a form in relation to how I drag/move the pictureBox.. All controls are inside .NET

Now I am working on this great Control, GMaps in which adapts the google's API in .NET framework.
My goal is to create something like the infoWindow on google's API. so I resorted on customizing it by creating a new form (acting as the infoWindow) on the first link above. If you've seen Gmaps.net, it really is a map. Draggable, pan to zoom, can add markers/polygons.. one thing that it lacks is its documentation + the infoWindow tool that I want with the marker..
it only has its "tooltip" that can only have string in it.
e.g marker.ToolTipText="Blah Blah"
on codeplex' discussions, it is said that you must create your own tooltip for it not to only display a string. but I can't find a good example except THIS in which inherits a contextMenu which I cannot particularly use because whenever I click again, it disappears.

back to my question, if you've checked the first link above, you'll know what I want to achieve, the only problem now is, I can't use this code as it is :

Point p = Button1.PointToScreen(Point.Empty);
p.Offset(0, (-1 * Form2.Height) - 15);
Form2.Location = p;

this code makes Form2 follow Button1 wherever it goes.. Unfortunately, on my gMap control, there is no button. there is only the marker inside.
Remember : this map is a controlenter image description here

so, how can I use the marker as a parent of the form, so if I try to drag the map, it follows.. something like this :

Point p = marker.PointToScreen(Point.Empty);
p.Offset(0, (-1 * Form2.Height) - 15);
Form2.Location = p;

UPDATE I used this code, no errors, does not work..

 void mainMap_MouseDown(object sender, MouseEventArgs e)
    {

        Point p = (marker.LocalPosition = PointToScreen(Point.Empty));
        //Point p = button1.PointToScreen(Point.Empty); --> this gives the error that it cannot be converted
        p.Offset(0, (-1 * f2.Height) - 15);
        f2.Location = p;
    }
Community
  • 1
  • 1
AdorableVB
  • 1,383
  • 1
  • 13
  • 44
  • it depends on your `marker`, if it supports some property to adjust its position, you can do the same with it as you do with the button. Try browsing all its members in the Object Browser window or the intellisense popup to see if there is any member (property or method) you can use to locate that marker. – King King Nov 28 '13 at 01:59
  • it says, cannot implicitly convert gmaps.net point to system.drawing.point. meaning, I think gmaps only recognizes latLong points. but let me check. – AdorableVB Nov 28 '13 at 02:03
  • see update.. tell me if there'e something you need. @KingKing – AdorableVB Nov 28 '13 at 02:40
  • Doesn't `marker` have any method like `PointToScreen`? does it have a parent? Is the `LocalPosition` relative to your picturebox? – King King Nov 28 '13 at 02:43
  • nope, that's where it gives the error since `PointToScreen` applies only for `System.Drawing` but the marker itself has its own LatLong points. and I think that `LocalPosition` property is in relative to the Form. btw, its not a pictureBox anymore. its an ActiveX control. that's why I am having problems with it. – AdorableVB Nov 28 '13 at 02:48
  • So the problem is how to convert LatLong to Point, you have to know where the (0,0) of the coordinates system is in which the marker's position is located, this problem is not easy to solve if we don't have much understanding about the coordinates system of the map, I know it lacks much documentation so searching more and trying yourself is the only way. – King King Nov 28 '13 at 02:53
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/42082/discussion-between-adorablevb-and-king-king) – AdorableVB Nov 28 '13 at 02:55
  • I can't see the sunlight in here. tried different formats, but it only comes down to one thing `cannot implicitly convert` isn't there a way to just get the marker's identity outside its control? @KingKing – AdorableVB Nov 28 '13 at 03:21

1 Answers1

0
 void mainMap_OnMapDrag()
    {

        f2.Show();
        f2.Location = marker.LocalPosition;
        //No offsetting..
    }

the LocalPosition property gets the position of the marker in relative to the screen. Only problem is the Dispose function in C#, if you only create one instance, you can't recreate it, if you add an instance, it will create Form2 every pixel moved. It'll be better in VB.

AdorableVB
  • 1,383
  • 1
  • 13
  • 44