コード例 #1
0
ファイル: frmSample55.cs プロジェクト: wsrf2009/KnxUiEditor
        private void InitializeGrid(object sender, System.EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;
            grid1.ColumnsCount = 3;

            // create header
            grid1.Rows.Insert(0);
            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("RichTextBox");

            // create 10 rows
            for (Int32 r = 1; r < 10; r++ )
            {
                grid1.Rows.Insert(r);

                // create three columns
                for (Int32 c = 0; c < 3; c++)
                {
                    // create richTextBox
                    SourceGrid.Cells.RichTextBox richTextBox = CreateRichTextBox();
                    SourceGrid.Cells.Views.RichTextBox richTextBoxView = CreateRichTextBoxView();
                    SourceGrid.Cells.Editors.RichTextBox editor = new SourceGrid.Cells.Editors.RichTextBox();
                    editor.Control.Multiline = true;
                    grid1[r, c] = richTextBox;
                    grid1[r, c].Editor = editor;
                    grid1[r, c].View = richTextBoxView;
                }
            }

            grid1.AutoSizeCells();
        }
コード例 #2
0
ファイル: RichTextGDI.cs プロジェクト: wsrf2009/KnxUiEditor
        /// <summary>
        /// Init rich text box control
        /// </summary>
        protected virtual void AssertRichTextBoxEditor()
        {
            if (RichTextBoxEditor == null)
            {
                RichTextBoxEditor = new SourceGrid.Cells.Editors.RichTextBox();
            }

            RichTextBoxEditor.Control.Clear();

            RichTextBoxEditor.Control.Value = Value;
            if (ForeColor != Color.FromKnownColor(KnownColor.WindowText))
            {
                RichTextBoxEditor.Control.SelectAll();
                RichTextBoxEditor.Control.SelectionColor = ForeColor;
            }
            if (TextAlignment != ContentAlignment.MiddleLeft)
            {
                RichTextBoxEditor.Control.SelectAll();
                RichTextBoxEditor.Control.SelectionAlignment = DevAge.Windows.Forms.Utilities.ContentToHorizontalAlignment(TextAlignment);
            }
            if (Font != System.Windows.Forms.Control.DefaultFont)
            {
                RichTextBoxEditor.Control.SelectAll();
                RichTextBoxEditor.Control.SelectionFont = Font;
            }
        }
コード例 #3
0
ファイル: frmSample55.cs プロジェクト: gehy1/sourcegrid
        private void InitializeGrid(object sender, System.EventArgs e)
        {
            grid1.BorderStyle  = BorderStyle.FixedSingle;
            grid1.ColumnsCount = 3;

            // create header
            grid1.Rows.Insert(0);
            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("RichTextBox");

            // create 10 rows
            for (Int32 r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);

                // create three columns
                for (Int32 c = 0; c < 3; c++)
                {
                    // create richTextBox
                    SourceGrid.Cells.RichTextBox         richTextBox     = CreateRichTextBox();
                    SourceGrid.Cells.Views.RichTextBox   richTextBoxView = CreateRichTextBoxView();
                    SourceGrid.Cells.Editors.RichTextBox editor          = new SourceGrid.Cells.Editors.RichTextBox();
                    editor.Control.Multiline = true;
                    grid1[r, c]        = richTextBox;
                    grid1[r, c].Editor = editor;
                    grid1[r, c].View   = richTextBoxView;
                }
            }

            grid1.AutoSizeCells();
        }