Guest User

Untitled

a guest
Jul 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. class MultyPagePanel : Panel
  2. {
  3. private int _currentPageIndex;
  4. public int CurrentPageIndex
  5. {
  6. get { return _currentPageIndex; }
  7. set
  8. {
  9. if (value >= 0 && value < (Controls.Count - 1))
  10. {
  11. Controls[value].BringToFront();
  12. _currentPageIndex = value;
  13. }
  14. }
  15. }
  16.  
  17. public void AddPage(Control page)
  18. {
  19. Controls.Add(page);
  20. page.Dock = DockStyle.Fill;
  21. }
  22. }
  23.  
  24. MultyPagePanel p;
  25.  
  26. // MyTabPage is a Control derived class that represents one page on your form.
  27. MyTabPage page = new MyTabPage();
  28. p.AddPage(page);
  29.  
  30. p.CurrentPageIndex = 0;
  31.  
  32. using System;
  33. using System.Windows.Forms;
  34.  
  35. class TablessControl : TabControl {
  36. protected override void WndProc(ref Message m) {
  37. // Hide tabs by trapping the TCM_ADJUSTRECT message
  38. if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
  39. else base.WndProc(ref m);
  40. }
  41. }
  42.  
  43. tcActionControls.Region = new Region(new RectangleF(
  44. tbPageToShow.Left,
  45. tbPageToShow.Top,
  46. tbPageToShow.Width,
  47. tbPageToShow.Height)
  48. );
  49.  
  50. public partial class TabControlWithoutHeader: TabControl
  51. {
  52. public TabControlWithoutHeader()
  53. {
  54. InitializeComponent();
  55. }
  56.  
  57. protected override void WndProc(ref Message m)
  58. {
  59. if (m.Msg == 0x1328 && !DesignMode)
  60. m.Result = (IntPtr)1;
  61. else
  62. base.WndProc(ref m);
  63. }
  64. }
Add Comment
Please, Sign In to add comment