Advertisement
MatthijsFontys

MyStandardFunctions C# winforms

Dec 17th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. /// <summary>
  2. /// Centers a form element horizontally relative to its parent element
  3. /// </summary>
  4. /// <param name="control">The form control you want to center</param>
  5. private void center(Control control)
  6. {
  7.     control.Left = (control.Parent.Width - control.Width) / 2;
  8. }
  9.  
  10. private void setTabControlSettings(){
  11.             // Hiding tab control headers
  12.             tabControl1.ItemSize = new Size(0, 1);
  13.             tabControl1.Size = this.ClientSize;
  14.             tabControl1.Location = new Point(0, -1);
  15.             tabControl1.Appearance = TabAppearance.FlatButtons;
  16.             tabControl1.SizeMode = TabSizeMode.Fixed;
  17.  
  18.             // Setting all the banners
  19.             setBanner(pnlAddFilterBanner);
  20.             setBanner(pnlLoginBanner);
  21.             setBanner(pnlRegisterBanner);
  22.  
  23.             // Centering the panels
  24.             center(pnlRegisterForm);
  25.             center(pnlLoginForm);
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement