コード例 #1
0
        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);
        }
コード例 #2
0
 private void HtmlSourceTextEditForm_FormClosing(
     object sender,
     FormClosingEventArgs e)
 {
     if (ExternalInformationProvider != null)
     {
         ExternalInformationProvider.SavePerUserPerWorkstationValue(
             StoreID + @".Width",
             Width.ToString(CultureInfo.InvariantCulture));
         ExternalInformationProvider.SavePerUserPerWorkstationValue(
             StoreID + @".Height",
             Height.ToString(CultureInfo.InvariantCulture));
         ExternalInformationProvider.SavePerUserPerWorkstationValue(
             StoreID + @".WordWrap",
             wordWrapCheckBox.Checked.ToString());
     }
 }
コード例 #3
0
        private void buttonOK_Click(
            object sender,
            EventArgs e)
        {
            if (IsNew)
            {
                var tmpHtml = string.Format(
                    @"<table border=""{0}"" cellpadding=""{1}"" cellspacing=""{2}"" width=""90%"">",
                    borderUpDown.Value,
                    cellPaddingUpDown.Value,
                    cellSpacingUpDown.Value) + Environment.NewLine;

                for (var row = 0; row < rowsUpDown.Value; ++row)
                {
                    tmpHtml += @"    <tr>" + Environment.NewLine;

                    for (var column = 0; column < columnsUpDown.Value; ++column)
                    {
                        if (row == 0 && firstRowContainsHeadlineCheckBox.Checked)
                        {
                            tmpHtml += string.Format(
                                @"        <th{0}{1}></th>" + Environment.NewLine,
                                calculateHorizontalAlignment(),
                                calculateVerticalAlignment());
                        }
                        else
                        {
                            tmpHtml += string.Format(
                                @"        <td{0}{1}></td>" + Environment.NewLine,
                                calculateHorizontalAlignment(),
                                calculateVerticalAlignment());
                        }
                    }

                    tmpHtml += @"    </tr>" + Environment.NewLine;
                }

                tmpHtml += @"</table>" + Environment.NewLine;

                _html = tmpHtml;
            }
            else
            {
                // Modify existing.

                // Add rows.
                while (_table.rows.length < rowsUpDown.Value)
                {
                    _table.insertRow();
                }

                // Add columns.
                for (var i = 0; i < _table.rows.length; ++i)
                {
                    var row = (IHTMLTableRow)_table.rows.item(i, i);

                    while (row.cells.length < columnsUpDown.Value)
                    {
                        var cell = (IHTMLTableCell)row.insertCell();

                        var element = (IHTMLElement)cell;
                        element.innerHTML = @"&nbsp;";
                    }
                }

                _table.border      = ConvertHelper.ToInt32(borderUpDown.Value);
                _table.cellSpacing = ConvertHelper.ToInt32(cellSpacingUpDown.Value);
                _table.cellPadding = ConvertHelper.ToInt32(cellPaddingUpDown.Value);
            }

            // --

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

                ExternalInformationProvider.SavePerUserPerWorkstationValue(StoreID +
                                                                           @"HtmlEditorTableNewDialog.HorizontalAlignmentIndex",
                                                                           horizontalAlignmentComboBox.SelectedIndex.ToString(CultureInfo.InvariantCulture));
                ExternalInformationProvider.SavePerUserPerWorkstationValue(StoreID +
                                                                           @"HtmlEditorTableNewDialog.VerticalAlignmentIndex",
                                                                           verticalAlignmentComboBox.SelectedIndex.ToString(CultureInfo.InvariantCulture));
            }
        }
コード例 #4
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();
        }