示例#1
0
        public TabStub(VisualStyle style)
        {
            // Default state
            _wct           = null;
            _style         = style;
            _hoverOver     = -1;
            _hoverItem     = -1;
            _selectedIndex = -1;
            _defaultFont   = true;
            _defaultColor  = true;
            _edge          = Edge.None;
            _drawTabs      = new ArrayList();
            _tabPages      = new TabPageCollection();
            base.Font      = SystemInformation.MenuFont;

            // Hookup to collection events
            _tabPages.Cleared  += new CollectionClear(OnClearedPages);
            _tabPages.Inserted += new CollectionChange(OnInsertedPage);
            _tabPages.Removing += new CollectionChange(OnRemovingPage);
            _tabPages.Removed  += new CollectionChange(OnRemovedPage);

            // Need notification when the MenuFont is changed
            Microsoft.Win32.SystemEvents.UserPreferenceChanged += new
                                                                  UserPreferenceChangedEventHandler(OnPreferenceChanged);

            // Default default colors
            DefineBackColor(SystemColors.Control);

            // Create the Timer for handling hovering over items
            _hoverTimer          = new Timer();
            _hoverTimer.Interval = _hoverInterval;
            _hoverTimer.Tick    += new EventHandler(OnTimerExpire);
        }
示例#2
0
        public HotZoneTabbed(Rectangle hotArea, Rectangle newSize, WindowContentTabbed wct, bool itself)
            : base(hotArea, newSize)
        {
            // Remember state
            _wct    = wct;
            _itself = itself;

            // Instead of a single rectangle for the dragging indicator we want to provide
            // two rectangles. One for the main area and another to show a tab extending
            // below it. This ensures the user can tell that it will be added as a new tab
            // page of the control.

            int tabHeight = _tabPageHeight;

            // Make sure the tab rectangle does not extend past end of control
            if (newSize.Height < (tabHeight + _dragWidth))
            {
                tabHeight = newSize.Height - _dragWidth * 3;
            }

            // Create the tab page extension
            _tabRect = new Rectangle(newSize.X + _tabPageLeft,
                                     newSize.Bottom - tabHeight,
                                     _tabPageWidth,
                                     tabHeight);

            // Make sure tab rectangle does not draw off right side of control
            if (_tabRect.Right > newSize.Right)
            {
                _tabRect.Width -= _tabRect.Right - newSize.Right;
            }

            // We want the intersection between the top left and top right corners to be displayed
            _tabRectTL = new Rectangle(_tabRect.X, _tabRect.Y, _dragWidth, _dragWidth);
            _tabRectTR = new Rectangle(_tabRect.Right - _dragWidth, _tabRect.Y, _dragWidth, _dragWidth);

            // Reduce the main area by the height of the above item
            _newSize.Height -= tabHeight - _dragWidth;
        }