コード例 #1
0
        public CCTabControl()
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            // The tab renderer and layout engine should be initialized before
            // doing anything that changes the font, size, or location of the
            // window since UpdateDisplayRectangle accesses _renderer and
            // _layoutEngine.

            // Get the dpi since the height in pixels of the font depends on it
            using (Graphics g = this.CreateGraphics())
            {
                _dpiY = g.DpiY;
            }

            _renderer     = new CCTabRenderer();
            _layoutEngine = new HorizontalRowLayoutEngine();

            _layoutEngine.LayoutRectangle = new Rectangle(_tabIndent, new Size(65536, (int)(_dpiY * (this.Font.Height + _renderer.TextPadding * 2) / 96F)));
            _layoutEngine.Spacing         = _renderer.TabSpacing.X;

            _selectedIndex      = -1;
            _tabPages           = new TabPageCollection(this);
            _GradientColor      = DefaultGradientColor;
            _PanelColor         = DefaultPanelColor;
            _SelectedPanelColor = DefaultSelectedPanelColor;
            _SelectedTextColor  = DefaultSelectedTextColor;
            _LineColor          = DefaultLineColor;
            _DisabledTextColor  = DefaultDisabledTextColor;
            ForeColor           = DefaultForeColor;

            Font = DefaultFont;
            Size = new Size(200, 100);
            UpdateDisplayRectangle();
        }
コード例 #2
0
 public TabInfo(Control ctl, CCTabRenderer c, string caption)
 {
     Text  = caption;
     State = TabState.Visible | TabState.Enabled;
 }