using System.Drawing;
using System.Drawing.Drawing2D;
namespace WindowsFormsApplication1
{
[Serializable]
public class GMapBaloonTool: GMapToolTip, ISerializable
{
public float Radius = 10f;
public GMapBaloonTool(GMapMarker marker)
: base(marker)
{
Stroke = new Pen(Color.FromArgb(140, Color.Navy));
Stroke.Width = 3;
this.Stroke.LineJoin = LineJoin.Round;
this.Stroke.StartCap = LineCap.RoundAnchor;
Fill = Brushes.Pink;
}
the above code, makes the tooltip change its color.
I am using gMaps.net to create custom google map inside winforms C#. I am working unto adding a marker + onClick event that will display video feeds from the DVR.
Only problem is that, the built in GMapsToolTip only displays strings although I have an activeX that act as a control for the camera.
What I need is to display the camera(activeX) inside the tooltip.
Saw this on a forum in greatmaps. Creator said I can make custom tooltips.
so what I am asking is, is it possible to create/add controls using this system.drawing namespace?
if possible, please do tell me how..
if not, if you know any other way, let know it.
public override void OnRender(Graphics g)
{
System.Drawing.Size st = g.MeasureString(Marker.ToolTipText, Font).ToSize();
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(Marker.ToolTipPosition.X, Marker.ToolTipPosition.Y - st.Height, st.Width + TextPadding.Width, st.Height + TextPadding.Height);
rect.Offset(Offset.X, Offset.Y);
using (GraphicsPath objGP = new GraphicsPath())
{
objGP.AddLine(rect.X + 2 * Radius, rect.Y + rect.Height, rect.X + Radius, rect.Y + rect.Height + Radius);
objGP.AddLine(rect.X + Radius, rect.Y + rect.Height + Radius, rect.X + Radius, rect.Y + rect.Height);
objGP.AddArc(rect.X, rect.Y + rect.Height - (Radius * 2), Radius * 2, Radius * 2, 90, 90);
objGP.AddLine(rect.X, rect.Y + rect.Height - (Radius * 2), rect.X, rect.Y + Radius);
objGP.AddArc(rect.X, rect.Y, Radius * 2, Radius * 2, 180, 90);
objGP.AddLine(rect.X + Radius, rect.Y, rect.X + rect.Width - (Radius * 2), rect.Y);
objGP.AddArc(rect.X + rect.Width - (Radius * 2), rect.Y, Radius * 2, Radius * 2, 270, 90);
objGP.AddLine(rect.X + rect.Width, rect.Y + Radius, rect.X + rect.Width, rect.Y + rect.Height - (Radius * 2));
objGP.AddArc(rect.X + rect.Width - (Radius * 2), rect.Y + rect.Height - (Radius * 2), Radius * 2, Radius * 2, 0, 90); // Corner
objGP.CloseFigure();
g.FillPath(Fill, objGP);
g.DrawPath(Stroke, objGP);
}
g.DrawString(Marker.ToolTipText, Font, Foreground, rect, Format);
g.DrawString(ToolTipText, ToolTipFont, TooltipForeground, rect, ToolTipFormat);
}
#region ISerializable Members
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Radius", this.Radius);
base.GetObjectData(info, context);
}
protected GMapBaloonTool(SerializationInfo info, StreamingContext context)
: base(info, context)
{
this.Radius = Extensions.GetStruct<float>(info, "Radius", 10f);
}
#endregion
}
}
this code makes the balloon on a rounded shape, so I don't know how to add my control to look something like this.. (made from html, but I need it on winforms)
hoping for someone who can help me. and oh, if you will only redirect me back to the discussion site of greatmaps, please don't. I can't understand much from there, so I asked in here.
You can try using the DrawToBitmap method on your camera control. I'd expect one of three things to happen:
Your best options are number 2 and 3, because they can be used to provide the functionality you want. If you get number 1, the control rendering doesn't use the usual render logic of Winforms, so you'll have to work around it.
In practice, you'll probably want a more direct access to the camera rendering output, because creating 25 bitmaps per second might be a little too much work to be useful. You'll get there :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With