Exemplo n.º 1
0
        /// <summary>
        /// Draw the mouse events image area
        /// </summary>
        /// <param name="sender">The sender of the event (the image area)</param>
        /// <param name="e">The event arguments</param>
        private void MouseArea_DrawImage(object sender, DrawImageEventArgs e)
        {
            Graphics        g            = e.Graphics;
            ImageAreaCircle a            = (ImageAreaCircle)sender;
            int             nShineOffset = a.Radius / 2;

            Rectangle r = new Rectangle(a.CenterPoint.X - a.Radius, a.CenterPoint.Y - a.Radius, a.Radius * 2,
                                        a.Radius * 2);

            r.Inflate(-2, -2);

            // Offset the area rectangle by the draw event offset
            r.Offset(e.ImageOffset.X, e.ImageOffset.Y);

            using (GraphicsPath pth = new GraphicsPath())
            {
                pth.AddEllipse(r);

                using (PathGradientBrush pgb = new PathGradientBrush(pth))
                {
                    pgb.CenterColor    = Color.White;
                    pgb.SurroundColors = new Color [] { Color.BurlyWood };
                    Point shine = new Point(a.CenterPoint.X - nShineOffset, a.CenterPoint.Y - nShineOffset);
                    shine.Offset(e.ImageOffset.X, e.ImageOffset.Y);
                    pgb.CenterPoint = shine;

                    g.FillEllipse(pgb, r);
                    g.DrawString((string)a.Tag, buttonFont, Brushes.Black, r, sfFormat);
                }
            }

            // We'll let the image map draw the focus frame when needed
            e.DrawFocus = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handle the mouse up event for the mouse image area
        /// </summary>
        /// <param name="sender">The sender of the event (the image area)</param>
        /// <param name="e">The event arguments</param>
        private void MouseArea_MouseUp(object sender, MouseEventArgs e)
        {
            ImageAreaCircle a = (ImageAreaCircle)sender;

            a.Tag = "Mouse Button Up";
            imMap.Invalidate();
            imMap.Update();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handle the mouse hover event for the mouse image area
        /// </summary>
        /// <param name="sender">The sender of the event (the image area)</param>
        /// <param name="e">The event arguments</param>
        private void MouseArea_MouseHover(object sender, EventArgs e)
        {
            ImageAreaCircle a = (ImageAreaCircle)sender;

            a.Tag = "Mouse Hovering";
            imMap.Invalidate();
            imMap.Update();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handle the mouse move event for the mouse image area
        /// </summary>
        /// <param name="sender">The sender of the event (the image area)</param>
        /// <param name="e">The event arguments</param>
        private void MouseArea_MouseMove(object sender, MouseEventArgs e)
        {
            ImageAreaCircle a = (ImageAreaCircle)sender;

            a.Tag = String.Format(CultureInfo.CurrentUICulture, "Mouse Move ({0},{1})", e.X, e.Y);
            imMap.Invalidate();
            imMap.Update();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handle the mouse leave event for the mouse image area
        /// </summary>
        /// <param name="sender">The sender of the event (the image area)</param>
        /// <param name="e">The event arguments</param>
        private void MouseArea_MouseLeave(object sender, EventArgs e)
        {
            ImageAreaCircle a = (ImageAreaCircle)sender;

            a.Tag = "Mouse Left Area";
        }
Exemplo n.º 6
0
        /// <summary>
        /// Handle the mouse enter event for the mouse image area
        /// </summary>
        /// <param name="sender">The sender of the event (the image area)</param>
        /// <param name="e">The event arguments</param>
        private void MouseArea_MouseEnter(object sender, EventArgs e)
        {
            ImageAreaCircle a = (ImageAreaCircle)sender;

            a.Tag = "Mouse Entered Area";
        }