예제 #1
0
        private void tablePropertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                IHTMLTable selectedElement = builder.GetSelectedTableElement();
                Table      selectedTable   = builder.GetSelectedTable();

                TablePropertiesDialog dlgTableProperties = new TablePropertiesDialog();
                if (selectedTable.BackgroundColor != null)
                {
                    dlgTableProperties.TableBackgroundColor = ConvertRgbToColor(selectedTable.BackgroundColor);
                }
                if (selectedTable.BorderColor != null)
                {
                    dlgTableProperties.TableBorderColor = ConvertRgbToColor(selectedTable.BorderColor);
                }
                if (selectedTable.BorderSize != null)
                {
                    dlgTableProperties.TableBorderSize = selectedTable.BorderSize;
                }
                if (selectedTable.Width != null)
                {
                    dlgTableProperties.TableWidth = selectedTable.Width;
                }
                if (selectedTable.Height != null)
                {
                    dlgTableProperties.TableHeight = selectedTable.Height;
                }
                if (selectedTable.CellSpacing != null)
                {
                    dlgTableProperties.TableCellSpacing = selectedTable.CellSpacing;
                }

                dlgTableProperties.ShowDialog();
                if (dlgTableProperties.DialogResult == DialogResult.OK)
                {
                    builder.ChangeTableProperty(selectedElement, TableProperties.BackgroundColor,
                                                ConvertColorToRgb(dlgTableProperties.TableBackgroundColor));
                    builder.ChangeTableProperty(selectedElement, TableProperties.BorderColor,
                                                ConvertColorToRgb(dlgTableProperties.TableBorderColor));
                    builder.ChangeTableProperty(selectedElement, TableProperties.BorderSize,
                                                dlgTableProperties.TableBorderSize.ToString());
                    builder.ChangeTableProperty(selectedElement, TableProperties.Height,
                                                dlgTableProperties.TableHeight.ToString());
                    builder.ChangeTableProperty(selectedElement, TableProperties.Width,
                                                dlgTableProperties.TableWidth.ToString());
                    builder.ChangeTableProperty(selectedElement, TableProperties.CellSpacing,
                                                dlgTableProperties.TableCellSpacing.ToString());

                    modifiedDocument = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #2
0
        private void tablePropertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                IHTMLTable selectedElement = builder.GetSelectedTableElement();
                Table selectedTable = builder.GetSelectedTable();

                TablePropertiesDialog dlgTableProperties = new TablePropertiesDialog();
                if (selectedTable.BackgroundColor != null)
                {
                    dlgTableProperties.TableBackgroundColor = ConvertRgbToColor(selectedTable.BackgroundColor);
                }
                if (selectedTable.BorderColor != null)
                {
                    dlgTableProperties.TableBorderColor = ConvertRgbToColor(selectedTable.BorderColor);
                }
                if (selectedTable.BorderSize != null)
                {
                    dlgTableProperties.TableBorderSize = selectedTable.BorderSize;
                }
                if (selectedTable.Width != null)
                {
                    dlgTableProperties.TableWidth = selectedTable.Width;
                }
                if (selectedTable.Height != null)
                {
                    dlgTableProperties.TableHeight = selectedTable.Height;
                }
                if (selectedTable.CellSpacing != null)
                {
                    dlgTableProperties.TableCellSpacing = selectedTable.CellSpacing;
                }

                dlgTableProperties.ShowDialog();
                if (dlgTableProperties.DialogResult == DialogResult.OK)
                {
                    builder.ChangeTableProperty(selectedElement, TableProperties.BackgroundColor,
                        ConvertColorToRgb(dlgTableProperties.TableBackgroundColor));
                    builder.ChangeTableProperty(selectedElement, TableProperties.BorderColor,
                        ConvertColorToRgb(dlgTableProperties.TableBorderColor));
                    builder.ChangeTableProperty(selectedElement, TableProperties.BorderSize,
                        dlgTableProperties.TableBorderSize.ToString());
                    builder.ChangeTableProperty(selectedElement, TableProperties.Height,
                        dlgTableProperties.TableHeight.ToString());
                    builder.ChangeTableProperty(selectedElement, TableProperties.Width,
                        dlgTableProperties.TableWidth.ToString());
                    builder.ChangeTableProperty(selectedElement, TableProperties.CellSpacing,
                        dlgTableProperties.TableCellSpacing.ToString());

                    modifiedDocument = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }