internal FormatCellsDialog(InitialSelectedTab initialTab, SpreadsheetSelectionAdapter adapter) { this.InitializeComponent(); this.adapter = adapter; this.InitializeUI(initialTab); }
private void InitializeUI(InitialSelectedTab initialTab) { try { this.SuspendLayout(); var font = adapter.Format.Font; var isInEditmode = this.adapter.IsInEditMode; if (isInEditmode) { this.tcMain.Tabs["Number"].Visible = false; this.tcMain.Tabs["Alignment"].Visible = false; this.tcMain.Tabs["Fill"].Visible = false; initialTab = InitialSelectedTab.Font; } // Initialize Number Tab this.numberFormats = Utils.GetNumberFormats(); this.treeCategory.SetDataBinding(this.numberFormats, null); // Initialize Alignment Tab this.cboHorizontal.DataSource = Enum.GetValues(typeof(HorizontalCellAlignment)); this.cboVertical.DataSource = Enum.GetValues(typeof(VerticalCellAlignment)); // Initialize Font Tab this.cboUnderline.DataSource = Enum.GetValues(typeof(FontUnderlineStyle)); this.treeFontFamily.SetDataBinding(StyleUtils.GetFontFamilyList(), null); this.treeFontStyle.SetDataBinding(Enum.GetValues(typeof(FontStylesCustom)), null); this.treeFontSize.SetDataBinding(StyleUtils.GetFontSizeValueList().ValueListItems, null); // Initialize Fill Tab this.cboPatternStyle.DataSource = Enum.GetValues(typeof(FillPatternStyle)).Cast <FillPatternStyle>().Where(x => x != FillPatternStyle.Default).ToList(); this.fillPreviewControl1.PreviewFill = adapter.Format.Fill; // Initialize Main TabControl this.tcMain.DrawFilter = this; this.tcMain.SelectedTab = this.tcMain.Tabs[initialTab.ToString()]; var selection = adapter.Selection; this.formatPreviewControl1.PreviewValue = adapter.SpreadSheet.ActiveWorksheet.Rows[adapter.Selection.ActiveCell.Row].Cells[selection.ActiveCell.Column].Value; this.LocalizeStrings(); } finally { this.ResumeLayout(); } }