¿puedo agregar un control en system.drawing, por ejemplo, un botón quizás?

    using System.Drawing;
    using System.Drawing.Drawing2D;

    namespace WindowsFormsApplication1
        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.
enter image description here

Estoy utilizando 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.
Sierra este 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

                    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);

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)

enter image description here

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.

preguntado el 27 de noviembre de 13 a las 02:11

Customizing a tooltip in winforms can be achieved by customizing a ToolStripControlHost, you should try searching on it, make some demo outside your current project to see it in action before applying on your project. There are many samples out there. The point is you must know how and when to show a tooltip at some point on your map. -

2 Respuestas

You can try using the DrawToBitmap method on your camera control. I'd expect one of three things to happen:

  • You get a black rectangle
  • You get one frame of the camera at the moment you called DrawToBitmap
  • You get a live video feed (thanks to overlay video playback features)

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 :)

respondido 28 nov., 13:14

Already got this to work for myself. Used an instance of a form to create an ventana de información Este is the link..

contestado el 23 de mayo de 17 a las 11:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.