private void PopulateLayoutList() { this.BackColor = SystemColors.Control; _layoutChoices.Controls.Clear(); _layoutChoices.RowCount = 0; _layoutChoices.RowStyles.Clear(); foreach (LayoutMethod choice in _model.GetLayoutChoices()) { var button = new Button(); button.Tag = choice; button.Text = choice.ToString(); button.Image = choice.GetImage(LayoutMethod.IsLandscape(_model.InputPdf)); button.FlatStyle = FlatStyle.Flat; button.FlatAppearance.BorderSize = 0; // item.Enabled = choice.GetIsEnabled(_model.IsLandscape); button.Click += new EventHandler((object sender, EventArgs e) => OnLayoutButtonClick((LayoutMethod)((Button)sender).Tag)); button.Height = 100; button.Width = 80;// _layoutChoices.GetColumnWidths()[0] - 20; button.TextImageRelation = TextImageRelation.ImageAboveText; button.TabIndex = _layoutChoices.RowCount; _layoutChoices.Controls.Add(button); _layoutChoices.RowCount++; _layoutChoices.RowStyles.Add(new RowStyle(SizeType.Absolute, button.Height)); } }
public void UpdateDisplay() { /*_showCropMarks.Enabled=*/ _mirrorBox.Enabled = _paperSizeCombo.Enabled = _model.SelectedMethod != null && _model.SelectedMethod.GetType() != typeof(NullLayoutMethod); _overBrowserPanel.Visible = !_model.ShowBrowser; foreach (Button button in _layoutChoices.Controls) { var method = ((LayoutMethod)button.Tag); if (method.ImageIsSensitiveToOrientation) { button.Image = method.GetImage(LayoutMethod.IsLandscape(_model.InputPdf)); } button.Enabled = _model.HaveIncomingPdf && method.GetIsEnabled(_model.InputPdf); button.FlatAppearance.BorderSize = _model.SelectedMethod != null && method.GetType() == _model.SelectedMethod.GetType() ? 2 : 0; } SetupPreviousLink(); }