title: Anchored control runs off the form by itself
body: <p>I have a control I built with several input controls on it, some text boxes, a combo box and a list box among other things. One text box, a combo box, a list box and a couple of command buttons are anchored so that they resize with the form. The combo box is anchored to the left, top and right, the listbox is anchored on all four sides and the buttons are anchored on the bottom and right. They all resize and maintain their position correctly. The problem is the text box I'm trying to anchor, just like the combo box. It runs off the right side of the form at runtime when anchored to the right. Yet, I don't have this problem with any of the existing controls on the form that are anchored to the right, they all stay in position like they're supposed to.</p>
  
  <p>I tried adding an additional text box and combobox and anchoring them to the right, but they too run off the right edge of the form. Why is it that the existing controls, except for one, work like they're supposed to but the one control and new ones become too wide?</p>
  
  <p>For reference, I've manipulated the designer generated code to rearrange the order of the statements so that the anchoring occurs after the position and width are set, but that did no good. Here's the code as is for the misbehaving textbox:</p>
  
  <pre><code>        // 
          // txtComments
          // 
          this.txtComments.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                      | System.Windows.Forms.AnchorStyles.Right)));
          this.txtComments.Location = new System.Drawing.Point(430, 6);
          this.txtComments.Name = "txtComments";
          this.txtComments.Size = new System.Drawing.Size(166, 20);
          this.txtComments.TabIndex = 25;
  </code></pre>
  
  <p>And the code for the properly behaving combobox:</p>
  
  <pre><code>        // 
          // cbMacroList
          // 
          this.cbMacroList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                      | System.Windows.Forms.AnchorStyles.Right)));
          this.cbMacroList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
          this.cbMacroList.FormattingEnabled = true;
          this.cbMacroList.Location = new System.Drawing.Point(128, 78);
          this.cbMacroList.Name = "cbMacroList";
          this.cbMacroList.Size = new System.Drawing.Size(468, 21);
          this.cbMacroList.TabIndex = 30;
          this.cbMacroList.SelectedIndexChanged += new System.EventHandler(this.cbMacroList_SelectedIndexChanged);
  </code></pre>
  
  <p>One final piece of background is that all of these controls came off of a Form when I determined I would need to reuse the functionality the form was providing in another form. I selected all the controls, cut them and then pasted onto the new UserControl. Before the migration to the UserControl, they all worked fine. This began showing up after migration.</p>