void Init(float w, float h) { Width = w; Height = h; float headHeight = 24; if (hideTabHeight) { headHeight = 0; } scTabHead = new ScTabHead(ScMgr, Width - 12, headHeight); scTabHead.SetItemSize(new SizeF(itemWidth, headHeight)); scTabHead.upOrBottom = upOrBottom; scTabHead.Location = new Point(6, 0); scTabHead.SelectedItemEvent += ScTabHead_SelectedItemEvent; // tabHeadBox = new ScLayer(); tabHeadBox.Width = Width; tabHeadBox.Height = headHeight; tabHeadBox.Add(scTabHead); Add(tabHeadBox); tabBodyBox = new ScLayer(); if (upOrBottom == 0) { float y = tabHeadBox.Location.Y + tabHeadBox.Height; tabBodyBox.Location = new PointF(0, y); tabBodyBox.Width = Width; tabBodyBox.Height = Height - tabHeadBox.Height; } else { tabBodyBox.Location = new PointF(0, 0); tabBodyBox.Width = Width; tabBodyBox.Height = Height - tabHeadBox.Height; float y = tabBodyBox.Location.Y + tabBodyBox.Height - 1; tabHeadBox.Location = new PointF(0, y); } tabBodyBox.D2DPaint += TabBodyBox_D2DPaint; tabBodyBox.GDIPaint += TabBodyBox_GDIPaint; tabBodyBox.MouseEnter += TabBodyBox_MouseEnter; tabBodyBox.MouseLeave += TabBodyBox_MouseLeave; Add(tabBodyBox); }
public ScTabHeadItem(ScMgr scMgr, ScTabHead scTabHead) : base(scMgr) { this.scTabHead = scTabHead; this.MouseDown += SimpleTabHeadItem_MouseDown; this.MouseEnter += ScTabHeadItem_MouseEnter; this.MouseLeave += ScTabHeadItem_MouseLeave; this.D2DPaint += ScTabHeadItem_D2DPaint; this.GDIPaint += ScTabHeadItem_GDIPaint; scAnim = new ScAnimation(this, 50, true); scAnim.AnimationEvent += ScAnim_AnimationEvent; IsUseOrgHitGeometry = false; }
public ScSharpTabHead() { InitializeComponent(); #region 防止打开闪烁 SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 #endregion this.Dock = DockStyle.Fill; scMgr = new ScMgr(Width, Height); scMgr.BackgroundColor = Color.FromArgb(255, 246, 247, 251); Controls.Add(scMgr.control); root = scMgr.GetRootLayer(); scTabHead = new ScTabHead(scMgr, root.Width, root.Height); scTabHead.Location = new Point(0, 0); scTabHead.Dock = ScDockStyle.Fill; root.Add(scTabHead); }