private void HtmlSourceTextEditForm_Load(object sender, EventArgs e)
        {
            if (ExternalInformationProvider != null)
            {
                Width = Convert.ToInt32(
                    ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                        StoreID + @".Width",
                        Width.ToString()));
                Height = Convert.ToInt32(
                    ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                        StoreID + @".Height",
                        Height.ToString()));

                wordWrapCheckBox.Checked =
                    Convert.ToBoolean(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @".WordWrap",
                            wordWrapCheckBox.Checked.ToString()));
            }
            CenterToParent();

            if (!DesignMode)
            {
                if (!_hasConsolasChecked)
                {
                    _hasConsolasChecked = true;

                    var families = FontFamily.Families;

                    if (families != null)
                    {
                        foreach (var family in families)
                        {
                            if (string.Compare(family.Name, @"Consolas", true) == 0)
                            {
                                _hasConsolas = true;
                                break;
                            }
                        }
                    }
                }

                if (_hasConsolas)
                {
                    textboxEdit.Font = new Font(@"Consolas", textboxEdit.Font.Size);
                }
            }

            textboxEdit.Select(0, 0);
        }
Exemple #2
0
        private void HtmlEditorTableNewForm_Load(
            object sender,
            EventArgs e)
        {
            CenterToParent();

            // --

            horizontalAlignmentComboBox.Items.Clear();
            horizontalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.HorizontalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Standard),
                    HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Standard));
            horizontalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.HorizontalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Left),
                    HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Left));
            horizontalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.HorizontalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Right),
                    HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Right));
            horizontalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.HorizontalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Center),
                    HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Center));
            horizontalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.HorizontalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Justify),
                    HtmlEditorCellPropertiesForm.HorizontalAlignmentType.Justify));

            verticalAlignmentComboBox.Items.Clear();
            verticalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.VerticalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.VerticalAlignmentType.Standard),
                    HtmlEditorCellPropertiesForm.VerticalAlignmentType.Standard));
            verticalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.VerticalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.VerticalAlignmentType.Top),
                    HtmlEditorCellPropertiesForm.VerticalAlignmentType.Top));
            verticalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.VerticalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.VerticalAlignmentType.Middle),
                    HtmlEditorCellPropertiesForm.VerticalAlignmentType.Middle));
            verticalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.VerticalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.VerticalAlignmentType.BaseLine),
                    HtmlEditorCellPropertiesForm.VerticalAlignmentType.BaseLine));
            verticalAlignmentComboBox.Items.Add(
                new Tuple <string, HtmlEditorCellPropertiesForm.VerticalAlignmentType>(
                    StringHelper.GetEnumDescription(HtmlEditorCellPropertiesForm.VerticalAlignmentType.Bottom),
                    HtmlEditorCellPropertiesForm.VerticalAlignmentType.Bottom));

            // --

            if (IsNew)
            {
                if (ExternalInformationProvider != null)
                {
                    rowsUpDown.Value = ConvertHelper.ToDecimal(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @"HtmlEditorTableNewDialog.RowCount",
                            rowsUpDown.Value.ToString(CultureInfo.InvariantCulture)));
                    columnsUpDown.Value = ConvertHelper.ToDecimal(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @"HtmlEditorTableNewDialog.ColCount",
                            columnsUpDown.Value.ToString(CultureInfo.InvariantCulture)));
                    borderUpDown.Value = ConvertHelper.ToDecimal(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @"HtmlEditorTableNewDialog.Border",
                            borderUpDown.Value.ToString(CultureInfo.InvariantCulture)));
                    cellSpacingUpDown.Value = ConvertHelper.ToDecimal(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @"HtmlEditorTableNewDialog.CellSpacing",
                            cellSpacingUpDown.Value.ToString(CultureInfo.InvariantCulture)));
                    cellPaddingUpDown.Value = ConvertHelper.ToDecimal(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @"HtmlEditorTableNewDialog.CellPadding",
                            cellPaddingUpDown.Value.ToString(CultureInfo.InvariantCulture)));

                    horizontalAlignmentComboBox.SelectedIndex = ConvertHelper.ToInt32(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @"HtmlEditorTableNewDialog.HorizontalAlignmentIndex",
                            0.ToString(CultureInfo.InvariantCulture)), 0);
                    verticalAlignmentComboBox.SelectedIndex = ConvertHelper.ToInt32(
                        ExternalInformationProvider.RestorePerUserPerWorkstationValue(
                            StoreID + @"HtmlEditorTableNewDialog.VerticalAlignmentIndex",
                            0.ToString(CultureInfo.InvariantCulture)), 0);
                }

                if (horizontalAlignmentComboBox.SelectedIndex < 0 &&
                    horizontalAlignmentComboBox.Items.Count > 0)
                {
                    horizontalAlignmentComboBox.SelectedIndex = 0;
                }
                if (verticalAlignmentComboBox.SelectedIndex < 0 &&
                    verticalAlignmentComboBox.Items.Count > 0)
                {
                    verticalAlignmentComboBox.SelectedIndex = 0;
                }
            }
            else
            {
                Text = Resources.Str_UIHtml_TableProperties;

                firstRowContainsHeadlineCheckBox.Visible = false;

                rowsUpDown.Minimum      = rowsUpDown.Value = _table.rows.length;
                columnsUpDown.Minimum   = columnsUpDown.Value = CountTableColumns(_table);
                borderUpDown.Value      = ConvertHelper.ToDecimal(_table.border);
                cellSpacingUpDown.Value = ConvertHelper.ToDecimal(_table.cellSpacing);
                cellPaddingUpDown.Value = ConvertHelper.ToDecimal(_table.cellPadding);

                label1.Enabled     =
                    label2.Enabled =
                        horizontalAlignmentComboBox.Enabled   =
                            verticalAlignmentComboBox.Enabled =
                                false;

                if (horizontalAlignmentComboBox.SelectedIndex < 0 &&
                    horizontalAlignmentComboBox.Items.Count > 0)
                {
                    horizontalAlignmentComboBox.SelectedIndex = 0;
                }
                if (verticalAlignmentComboBox.SelectedIndex < 0 &&
                    verticalAlignmentComboBox.Items.Count > 0)
                {
                    verticalAlignmentComboBox.SelectedIndex = 0;
                }
            }

            // --

            updateUI();
        }