private void BuildDataFieldList() { int origWindowHeight = this.Height; int origDataFieldListHeight = DataFieldList.Height; int origWindowWidth = this.Width; int origDataFieldListWidth = DataFieldList.Width; int numFields = InstrumentData.NumOfFields(); if (!includeNonDataFields) { numFields = InstrumentData.NumDataFields(); } int fieldNum = 0; for (fieldNum = 0; fieldNum < numFields; fieldNum++) { DataFieldList.Items.Add(InstrumentData.FieldName(fieldNum)); } DataFieldList.SelectedItem = selectedDataField; int totalHeightNeeded = InstrumentData.NumOfFields() * DataFieldList.ItemHeight + 30; DataFieldList.Height = totalHeightNeeded; int newWindowHeight = DataFieldList.Height + (origWindowHeight - origDataFieldListHeight); int newWindowWidth = DataFieldList.Width + (origWindowWidth - origDataFieldListWidth); this.Height = newWindowHeight; this.Width = newWindowWidth; }