Пример #1
0
        //=====================================================================

        /// <summary>
        /// The image map can handle click events or the areas can handle their own events.  In this demo, the
        /// image map handles the click event for areas 1, 2, 5, and 6.  Area 0 has it's own Click handler and
        /// area 3 only responds to double-clicks with its own DoubleClick handler.
        /// </summary>
        /// <param name="sender">The sender of the event (the image map)</param>
        /// <param name="e">The event arguments</param>
        private void imMap_Click(object sender, ImageMapClickEventArgs e)
        {
            // We'll handle the click for image area 0 (toggle the image map's owner status)
            switch (imMap.FocusedArea)
            {
            case 5:         // Show the interactive property demo
                using (ImageMapPropertyForm dlg = new ImageMapPropertyForm())
                {
                    dlg.ShowDialog();
                }
                break;

            case 6:         // Exit the application
                this.Close();
                break;

            default:
                if (imMap.FocusedArea != 0 && imMap.FocusedArea != 3)
                {
                    MessageBox.Show(String.Format(CultureInfo.CurrentUICulture, "You clicked area " +
                                                  "#{0} ({1}) at point {2}, {3}", e.AreaIndex + 1, imMap.Areas[e.AreaIndex].ToolTip,
                                                  e.XCoordinate, e.YCoordinate), "Image Map Clicked", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                break;
            }
        }
Пример #2
0
        //=====================================================================
        /// <summary>
        /// The image map can handle click events or the areas can handle their own events.  In this demo, the
        /// image map handles the click event for areas 1, 2, 5, and 6.  Area 0 has it's own Click handler and
        /// area 3 only responds to double-clicks with its own DoubleClick handler.
        /// </summary>
        /// <param name="sender">The sender of the event (the image map)</param>
        /// <param name="e">The event arguments</param>
        private void imMap_Click(object sender, ImageMapClickEventArgs e)
        {
            // We'll handle the click for image area 0 (toggle the image map's owner status)
            switch(imMap.FocusedArea)
            {
                case 5:     // Show the interactive property demo
                    using(ImageMapPropertyForm dlg = new ImageMapPropertyForm())
                    {
                        dlg.ShowDialog();
                    }
                    break;

                case 6:     // Exit the application
                    this.Close();
                    break;

                default:
                    if(imMap.FocusedArea != 0 && imMap.FocusedArea != 3)
                        MessageBox.Show(String.Format(CultureInfo.CurrentUICulture, "You clicked area " +
                            "#{0} ({1}) at point {2}, {3}", e.AreaIndex + 1, imMap.Areas[e.AreaIndex].ToolTip,
                            e.XCoordinate, e.YCoordinate), "Image Map Clicked", MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
                    break;
            }
        }