Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        internal override void handleEvent(EventType type, Object sender, EventArgs e)
        {
            MapData mapData = ControlsMap.getInstance().getMapData(sender);

            if (mapData == null)
            {
                return;
            }

            Object guiMgObject = mapData.getControl();

            if (guiMgObject == null)
            {
                guiMgObject = mapData.getForm();
            }
            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(guiMgObject));

            try
            {
                switch (type)
                {
#if !PocketPC
                case EventType.SCROLL:
                {
                    if (sender is ScrollableControl)
                    {
                        ScrollableControl scrollableControl = sender as ScrollableControl;
                        TagData           tg = (TagData)scrollableControl.Tag;
                        if (scrollableControl.BackgroundImage != null)
                        {
                            scrollableControl.Invalidate();
                        }
                        else
                        {
                            //This is a.Net bug. When scrollbar gets hidden during the process of thumb drag, framework still keeps
                            //a rectangular bar visible to keep dragging on. Now, this rectangle is not removed even when the scrolling is stopped.
                            //The workaround is to repaint the form if scrollbar is not present on the form when scroll dragging is stopped.

                            ScrollEventArgs se = (ScrollEventArgs)e;
                            if (se.Type == ScrollEventType.ThumbPosition)
                            {
                                bool hasVerticalScrollBar = scrollableControl.AutoScrollMinSize.Height > scrollableControl.ClientSize.Height;

                                if (!hasVerticalScrollBar)
                                {
                                    scrollableControl.Invalidate();
                                }
                            }
                        }
                    }
                }
                break;
#endif
                case EventType.RESIZE:
                    onResize((Control)sender);
                    break;
                }
                DefaultContainerHandler.getInstance().handleEvent(type, sender, e);

#if PocketPC
                // paint the subform's border. Do it after the controls are painted, so we can paint over them.
                if (type == EventType.PAINT && ((MgPanel)sender).BorderStyle != BorderStyle.None)
                {
                    BorderRenderer.PaintBorder(((PaintEventArgs)e).Graphics, ((Control)sender).ClientRectangle,
                                               Color.Black, ControlStyle.Windows, false);
                }
#endif
            }
            finally
            {
                contextIDGuard.Dispose();
            }
        }
Esempio n. 2
0
 public void Toggle(object o, EventArgs e)
 {
     drawn = !drawn;
     owner.Invalidate(BoundingRectangle);
 }