Advertisement
Dilbert

WinForms tabpage not repainting on form resize

Sep 9th, 2012
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.28 KB | None | 0 0
  1. /// visit http://stackoverflow.com/q/12338241/1488067
  2. /// for more info
  3.  
  4. public class Form1 : Form
  5. {
  6.     /// <summary>
  7.     /// Required designer variable.
  8.     /// </summary>
  9.     private System.ComponentModel.IContainer components = null;
  10.  
  11.     /// <summary>
  12.     /// Clean up any resources being used.
  13.     /// </summary>
  14.     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  15.     protected override void Dispose(bool disposing)
  16.     {
  17.         if (disposing && (components != null))
  18.         {
  19.             components.Dispose();
  20.         }
  21.         base.Dispose(disposing);
  22.     }
  23.  
  24.     #region Windows Form Designer generated code
  25.  
  26.     /// <summary>
  27.     /// Required method for Designer support - do not modify
  28.     /// the contents of this method with the code editor.
  29.     /// </summary>
  30.     private void InitializeComponent()
  31.     {
  32.         this.tabControl1 = new System.Windows.Forms.TabControl();
  33.         this.tabPage = new System.Windows.Forms.TabPage();
  34.         this.textBox1 = new System.Windows.Forms.TextBox();
  35.         this.label2 = new System.Windows.Forms.Label();
  36.         this.tabControl1.SuspendLayout();
  37.         this.tabPage.SuspendLayout();
  38.         this.SuspendLayout();
  39.         //
  40.         // tabControl1
  41.         //
  42.         this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  43.         | System.Windows.Forms.AnchorStyles.Left)
  44.         | System.Windows.Forms.AnchorStyles.Right)));
  45.         this.tabControl1.Controls.Add(this.tabPage);
  46.         this.tabControl1.Location = new System.Drawing.Point(12, 37);
  47.         this.tabControl1.Name = "tabControl1";
  48.         this.tabControl1.SelectedIndex = 0;
  49.         this.tabControl1.Size = new System.Drawing.Size(260, 213);
  50.         this.tabControl1.TabIndex = 0;
  51.         //
  52.         // tabPage
  53.         //
  54.         this.tabPage.Controls.Add(this.label2);
  55.         this.tabPage.Controls.Add(this.textBox1);
  56.         this.tabPage.Location = new System.Drawing.Point(4, 22);
  57.         this.tabPage.Name = "tabPage";
  58.         this.tabPage.Padding = new System.Windows.Forms.Padding(3);
  59.         this.tabPage.Size = new System.Drawing.Size(252, 187);
  60.         this.tabPage.TabIndex = 0;
  61.         this.tabPage.Text = "One tab";
  62.         this.tabPage.UseVisualStyleBackColor = true;
  63.         //
  64.         // textBox1
  65.         //
  66.         this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  67.         | System.Windows.Forms.AnchorStyles.Left)
  68.         | System.Windows.Forms.AnchorStyles.Right)));
  69.         this.textBox1.Location = new System.Drawing.Point(17, 38);
  70.         this.textBox1.Multiline = true;
  71.         this.textBox1.Name = "textBox1";
  72.         this.textBox1.Size = new System.Drawing.Size(216, 130);
  73.         this.textBox1.TabIndex = 0;
  74.         this.textBox1.Text = "This is a text box.";
  75.         //
  76.         // label2
  77.         //
  78.         this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  79.         | System.Windows.Forms.AnchorStyles.Right)));
  80.         this.label2.Location = new System.Drawing.Point(14, 13);
  81.         this.label2.Name = "label2";
  82.         this.label2.Size = new System.Drawing.Size(219, 15);
  83.         this.label2.TabIndex = 2;
  84.         this.label2.Text = "Some other label";
  85.         //
  86.         // Form1
  87.         //
  88.         this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  89.         this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  90.         this.ClientSize = new System.Drawing.Size(284, 262);
  91.         this.Controls.Add(this.tabControl1);
  92.         this.Name = "Form1";
  93.         this.Text = "Test form";
  94.         this.tabControl1.ResumeLayout(false);
  95.         this.tabPage.ResumeLayout(false);
  96.         this.tabPage.PerformLayout();
  97.         this.ResumeLayout(false);
  98.         this.PerformLayout();
  99.  
  100.     }
  101.  
  102.     #endregion
  103.  
  104.     private System.Windows.Forms.TabControl tabControl1;
  105.     private System.Windows.Forms.TabPage tabPage;
  106.     private System.Windows.Forms.Label label2;
  107.     private System.Windows.Forms.TextBox textBox1;
  108.  
  109.     public Form1()
  110.     {
  111.         InitializeComponent();
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement