private void PageSettingsForm_Shown(object sender, EventArgs e) { PageSettings settings = WbContext.get_page_settings(); paperSizeCombo.Items.Clear(); List <PaperSize> paperSizes = WbContext.get_paper_sizes(); foreach (PaperSize paper in paperSizes) { int i = paperSizeCombo.Items.Add(paper.caption); if (settings.paper_type == paper.name) { paperSizeCombo.SelectedIndex = i; } } //paperSizeCombo.Items.Add("Add Custom Size..."); TopMargin = settings.margin_top; BottomMargin = settings.margin_bottom; LeftMargin = settings.margin_left; RightMargin = settings.margin_right; topMarginText.Text = settings.margin_top.ToString(); bottomMarginText.Text = settings.margin_bottom.ToString(); leftMarginText.Text = settings.margin_left.ToString(); rightMarginText.Text = settings.margin_right.ToString(); if (settings.orientation == "landscape") { landscapeRadio.Checked = true; } else { portraitRadio.Checked = true; } if (paperSizeCombo.SelectedIndex >= 0) { paperSizeLabel.Text = paperSizes[paperSizeCombo.SelectedIndex].description; } }