public TabSheet AddPage(string caption) { TabSheet result = new TabSheet(this); result.Caption = caption; result.Visible = false; ResizeSheet(result); return(result); }
public TabSheet GetPage(int index) { TabSheet result = null; if (index >= 0 && index < Controls.Count) { result = ((TabSheet)Controls[index]); } return(result); }
private void ResizeSheet(TabSheet sheet) { int th = 8; if (Font != null) { th += Font.Height; } sheet.Top = th; sheet.Left = 0; sheet.Width = Width; sheet.Height = Height - th; }
protected override void DoPaintEvent(BaseScreen screen) { ExtRect crt = ClientRect; int L = crt.Left; int T = crt.Top; int R = crt.Right; int B = crt.Bottom; int h = 8; if (Font != null) { h += Font.Height; } int mw = 0; ExtRect tsr; int num = PagesCount; for (int idx = 0; idx < num; idx++) { TabSheet page = GetPage(idx); int tw = screen.GetTextWidth(page.Caption) + 16; tsr = ExtRect.Create(L + mw, T + 0, L + mw + tw - 1, T + h - 1); mw += tw; CtlBorders brd; if (idx == TabIndex) { brd = new CtlBorders(CtlBorders.cbLeft, CtlBorders.cbTop, CtlBorders.cbRight); } else { brd = new CtlBorders(CtlBorders.cbLeft, CtlBorders.cbTop, CtlBorders.cbRight, CtlBorders.cbBottom); } CtlCommon.DrawCtlBorder(screen, tsr, brd); screen.DrawText(tsr.Left + 8, tsr.Top + 4, page.Caption, 0); } tsr = ExtRect.Create(L + mw, T + h - 2, R, B); screen.DrawFilled(tsr, BaseScreen.FILL_HORZ, 2, 0, 31, 2, mw, T + h - 2, CtlCommon.CtlDecor); tsr = ExtRect.Create(L, T + h, R, B); CtlCommon.DrawCtlBorder(screen, tsr, new CtlBorders(CtlBorders.cbLeft, CtlBorders.cbRight, CtlBorders.cbBottom)); }