bool textChangedFlag; // True means unsaved changes exist; false means file is up-to-date. #endregion Fields #region Constructors public SimpleWordProcessor() : base() { textbox = new RichTextBox(); textbox.Parent = this; textbox.Dock = DockStyle.Fill; textbox.AcceptsTab = true; textbox.TextChanged += delegate(object sender, EventArgs args) { textChangedFlag = true; }; // Display save prompt if closing with unsaved data. this.FormClosing += delegate(object sender, FormClosingEventArgs args) { if(!confirmSave()) args.Cancel = true; }; this.Text = "SimpleWordProcessor"; this.Width = 600; this.Height = 480; fDiag = new FontDialog(); cDiag = new ColorDialog(); sDiag = new SaveFileDialog(); oDiag = new OpenFileDialog(); textChangedFlag = false; buildMenu(); }
private static string ConvertRtfToXaml(string rtfText) { var richTextBox = new RichTextBox(); if (string.IsNullOrEmpty(rtfText)) return ""; var textRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd); //Create a MemoryStream of the Rtf content using (var rtfMemoryStream = new MemoryStream()) { using (var rtfStreamWriter = new StreamWriter(rtfMemoryStream)) { rtfStreamWriter.Write(rtfText); rtfStreamWriter.Flush(); rtfMemoryStream.Seek(0, SeekOrigin.Begin); //Load the MemoryStream into TextRange ranging from start to end of RichTextBox. textRange.Load(rtfMemoryStream, DataFormats.Rtf); } } using (var rtfMemoryStream = new MemoryStream()) { textRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd); textRange.Save(rtfMemoryStream, DataFormats.Xaml); rtfMemoryStream.Seek(0, SeekOrigin.Begin); using (var rtfStreamReader = new StreamReader(rtfMemoryStream)) { return rtfStreamReader.ReadToEnd(); } } }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Top; _richTextBox.Height = 120; Controls.Add (_richTextBox); // // _textBox // _textBox = new TextBox (); _textBox.Dock = DockStyle.Bottom; _textBox.Height = 120; _textBox.Multiline = true; Controls.Add (_textBox); // // MainForm // ClientSize = new Size (300, 250); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #81682"; Load += new EventHandler (MainForm_Load); }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.ReadOnly = true; _richTextBox.Dock = DockStyle.Fill; _richTextBox.SelectionColor = Color.Black; _richTextBox.AppendText ("should be colored black"); _richTextBox.SelectionColor = Color.Red; _richTextBox.AppendText ("\r\nshould have a red color"); _richTextBox.SelectionColor = Color.Empty; _richTextBox.AppendText ("\r\nshould be default color"); _richTextBox.SelectionColor = Color.Black; _richTextBox.AppendText ("\r\nshould be colored black"); _richTextBox.SelectionFont = new Font (_richTextBox.SelectionFont, FontStyle.Bold); _richTextBox.AppendText (" and now bold"); _richTextBox.SelectionColor = Color.Red; _richTextBox.AppendText ("\r\nshould have a red color"); _richTextBox.SelectionColor = Color.Empty; _richTextBox.AppendText ("\r\nshould be default color"); Controls.Add (_richTextBox); // // MainForm // ClientSize = new Size (300, 150); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #351576"; Load += new EventHandler (MainForm_Load); }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Top; _richTextBox.Height = 300; _richTextBox.TabIndex = 0; Controls.Add (_richTextBox); // // _pictureBox // _pictureBox = new PictureBox (); _pictureBox.BackColor = Color.White; _pictureBox.BorderStyle = BorderStyle.Fixed3D; _pictureBox.Dock = DockStyle.Bottom; _pictureBox.Height = 300; Controls.Add (_pictureBox); // // MainForm // AutoScaleBaseSize = new Size (5, 13); ClientSize = new Size (400, 600); Location = new Point (150, 100); StartPosition = FormStartPosition.Manual; Text = "bug #81915"; Load += new EventHandler (MainForm_Load); }
public RichTextBoxExam() { richTextBox = new RichTextBox(); richTextBox.Parent = this; richTextBox.Dock = DockStyle.Fill; this.Load += new EventHandler(RichTextBoxExam_Load); }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Bottom; _richTextBox.SelectionAlignment = HorizontalAlignment.Center; _richTextBox.AppendText ("Title"); Controls.Add (_richTextBox); // // _alignButton // _alignButton = new Button (); _alignButton.Text = "Left Align"; _alignButton.Dock = DockStyle.Top; _alignButton.Click += new EventHandler (AlignButton_Click); Controls.Add (_alignButton); // // MainForm // ClientSize = new Size (300, 130); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #351918"; Load += new EventHandler (MainForm_Load); }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Top; _richTextBox.Height = 160; Controls.Add (_richTextBox); // // _wordWrapCheckBox // _wordWrapCheckBox = new CheckBox (); _wordWrapCheckBox.Checked = _richTextBox.WordWrap; _wordWrapCheckBox.Location = new Point (8, 170); _wordWrapCheckBox.Text = "WordWrap"; _wordWrapCheckBox.CheckedChanged += new EventHandler (WordWrapCheckBox_CheckedChanged); Controls.Add (_wordWrapCheckBox); // // MainForm // ClientSize = new Size (300, 200); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #81488"; Load += new EventHandler (MainForm_Load); }
public static void RestoreRedraw(RichTextBox richTextBox) { LockWindowUpdate(IntPtr.Zero); // Restore selection and color state richTextBox.SelectionStart = lastSelection; richTextBox.SelectionLength = 0; richTextBox.SelectionColor = richTextBox.ForeColor; }
public static RichTextBox GetRichTextBoxAnon(string s) { RichTextBox txt = new RichTextBox(); txt.Multiline = true; txt.WordWrap = true; txt.Text = s; txt.Dock = DockStyle.Fill; return txt; }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Top; _richTextBox.Height = 200; _richTextBox.Multiline = true; _richTextBox.ReadOnly = true; _richTextBox.Text = "Jackson"; Controls.Add (_richTextBox); // // _readOnlyCheckBox // _readOnlyCheckBox = new CheckBox (); _readOnlyCheckBox.Checked = true; _readOnlyCheckBox.Location = new Point (8, 210); _readOnlyCheckBox.Size = new Size (80, 20); _readOnlyCheckBox.Text = "ReadOnly"; _readOnlyCheckBox.CheckedChanged += new EventHandler (ReadOnlyCheckBox_CheckedChanged); Controls.Add (_readOnlyCheckBox); // // _blueCheckBox // _blueCheckBox = new CheckBox (); _blueCheckBox.Location = new Point (250, 210); _blueCheckBox.Size = new Size (80, 20); _blueCheckBox.Text = "Blue"; _blueCheckBox.CheckedChanged += new EventHandler (BlueCheckBox_CheckedChanged); Controls.Add (_blueCheckBox); // // _backColorLabel // _backColorLabel = new Label (); _backColorLabel.Location = new Point (8, 240); _backColorLabel.Size = new Size (80, 20); _backColorLabel.Text = "BackColor:"; Controls.Add (_backColorLabel); // // _backColorValue // _backColorValue = new Label (); _backColorValue.Location = new Point (100, 240); _backColorValue.Size = new Size (150, 20); Controls.Add (_backColorValue); // // MainForm // ClientSize = new Size (300, 270); Location = new Point (200, 100); StartPosition = FormStartPosition.Manual; Text = "bug #79949"; Load += new EventHandler (MainForm_Load); }
public RichTextBoxDocumentManager(RichTextBox rtf) { if (rtf == null) throw new ArgumentNullException("必须传入一个有效的RichTextBox控件引用"); _rtf = rtf; SaveFileDialog1.Filter = "FlowDocument的XAML包文件(*.xamlpackage)|*.xamlpackage|FlowDocument的纯XAML文件(*.xaml)|*.xaml|标准XAML代码文件(*.xaml)|*.xaml|RTF文件(*.rtf)|*.rtf|纯文本文件(*.txt)|*.txt|任意扩展名(以纯文本格式表达)|*.*"; OpenFileDialogForImageFile.Filter = "所有可处理类型的文件|*.gif;*.jpg;*.jpeg;*.png;*.bmp|JPG文件(*.jpg;*.jpeg)|*.jpg;*.jpeg|Gif文件(*.gif)|*.gif|PNG文件(*.png)|*.png|BMP文件(*.bmp)|*.bmp|任意扩展名文件(*.*)|*.*"; CurFileName = "无标题.xaml"; }
public static void StopRedraw(RichTextBox richTextBox) { LockWindowUpdate(richTextBox.Handle); // Save the last location lastSelection = richTextBox.SelectionStart; // Refresh colors richTextBox.SelectAll(); richTextBox.SelectionColor = richTextBox.ForeColor; }
static void Main () { TextBox textBox = new TextBox (); textBox.CreateControl (); for (int i = 1; i <= 1000; i++) textBox.AppendText (string.Format ("This is line {0}", i)); RichTextBox rtb = new RichTextBox (); rtb.CreateControl (); for (int i = 1; i <= 1000; i++) rtb.AppendText (string.Format ("This is line {0}", i)); }
public static string ConvertToText(string rtf) { if (rtf.StartsWith(@"{\rtf")) { RichTextBox rtb = new RichTextBox(); rtb.Rtf = rtf; return rtb.Text.Replace("\r", "<br/>").Replace("\n", "<br/>"); ; } else { return rtf; } }
public void InterfaceReimplementation() { RichTextBox r = new RichTextBox(); r.Undo(); // RichTextBox.Undo Case 1 ((IUndoable)r).Undo(); // RichTextBox.Undo Case 2 // this is an interesting siutation // we are trying to call the interface method of the base class // but because we reimplemented, calling the base class interface calls the subclass NON interface code ((IUndoable)((TextBox)r)).Undo(); // TextBox.Undo Case 3 // since this is a bit confusing, it is a better idea to try // and use virtual and override keywords to do this }
public static void HighlightPhrase(RichTextBox box, string phrase, Color color) { int pos = box.SelectionStart; string s = box.Text; for (int ix = 0; ; ) { int jx = s.IndexOf(phrase, ix, StringComparison.CurrentCultureIgnoreCase); if (jx < 0) break; box.SelectionStart = jx; box.SelectionLength = phrase.Length; box.SelectionColor = color; ix = jx + 1; } box.SelectionStart = pos; box.SelectionLength = 0; }
public static void Get_Maps(SQLiteConnection db_Connection, ref ComboBox cBox_map_name, ref RichTextBox rTBox_log) { Get_Maps(db_Connection); if(maps != null) { cBox_map_name.Items.Clear(); rTBox_log.Text += String.Format("{0} {1}", "***Maps Loading Started***", "\r\n"); for(int i = 0; i < maps.Length;i++) { cBox_map_name.Items.Add(maps[i].Human_readable_name); rTBox_log.Text += String.Format("Engine name: {0,-18} | Human-readable name: {1}", maps[i].Engine_Name, maps[i].Human_readable_name); rTBox_log.Text += Environment.NewLine; } rTBox_log.Text += String.Format("{0} {1}", "***Maps Loading Finished***", "\r\n"); } }
public static void Get_GameModes(SQLiteConnection db_Connection, String game_modes_list, ref ComboBox cBox_game_mode, ref RichTextBox rTBox_log) { Get_GameModes(db_Connection, game_modes_list); if (game_modes != null) { cBox_game_mode.Items.Clear(); rTBox_log.Text += String.Format("{0} {1}", "***Game Mode Loading Started***", "\r\n"); for (int i = 0; i < game_modes.Length; i++) { cBox_game_mode.Items.Add(game_modes[i].Human_readable_name); rTBox_log.Text += String.Format("Engine name: {0,-18} | Human-readable name: {1}", game_modes[i].Engine_Name, game_modes[i].Human_readable_name); rTBox_log.Text += Environment.NewLine; } rTBox_log.Text += String.Format("{0} {1}", "***Game Mode Loading Finished***", "\r\n"); } }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Fill; Controls.Add (_richTextBox); // // MainForm // ClientSize = new Size (570, 300); Location = new Point (70, 100); StartPosition = FormStartPosition.Manual; Text = "bug #81178"; Load += new EventHandler (MainForm_Load); }
public static RichTextBox GetRichTextBox(string s) { RichTextBox txt = new RichTextBox(); txt.Multiline = true; txt.WordWrap = true; txt.ReadOnly = true; txt.BorderStyle = BorderStyle.None; txt.Text = s; txt.Dock = DockStyle.Fill; txt.SelectionChanged += delegate (object o, EventArgs a) { if (txt.SelectedText != String.Empty) { Clipboard.SetDataObject(txt.SelectedText); Console.WriteLine(Clipboard.GetText()); } }; return txt; }
public MainForm () { // // _richtTextBox // _richtTextBox = new RichTextBox (); _richtTextBox.Dock = DockStyle.Fill; _richtTextBox.LinkClicked += new LinkClickedEventHandler (RichTextBox_LinkClicked); Controls.Add (_richtTextBox); // // MainForm // ClientSize = new Size (300, 100); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #342516"; Load += new EventHandler (MainForm_Load); }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Fill; _richTextBox.Font = new Font (FontFamily.GenericSansSerif, 14f); Controls.Add (_richTextBox); // // MainForm // ClientSize = new Size (300, 130); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #351885"; Load += new EventHandler (MainForm_Load); }
public GuiConsoleForm(string caption, string cmdPrompt, StringHandler h) { Text = caption; prompt = cmdPrompt; stringHandler = h; textBox = new ConsoleTextBox(this); textBox.Dock = DockStyle.Fill; textBox.Font = new Font("Tahoma",10,FontStyle.Bold); textBox.WordWrap = false; Width = 750; Size = new Size(467, 400); timer.Interval = 50; timer.Tick += new EventHandler(Execute); this.Controls.Add(textBox); }
public HelloForm() { this.Text = "Hello Form"; this.StartPosition = FormStartPosition.CenterScreen; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.ControlBox = true; this.MaximizeBox = false; this.MinimizeBox = false; this.BackColor = Color.Red; //this.icon = new Icon(); this.ResizeRedraw = true; btnOK = new Button(); btnOK.Text = "OK"; btnOK.Left = this.ClientRectangle.Width-btnOK.Width-10; btnOK.Top = this.ClientRectangle.Height-btnOK.Height-10; btnOK.Visible = true; btnOK.Click += new EventHandler(btnOK_Click); this.Controls.Add(btnOK); lblPhones = new Label(); lblPhones.Left = 0; lblPhones.Width = this.Width; lblPhones.Top = this.Height/6; lblPhones.Font = new Font(lblPhones.Font, FontStyle.Bold); lblPhones.TextAlign = ContentAlignment.MiddleCenter; lblPhones.Text = "P H O N E S"; lblPhones.Visible = true; this.Controls.Add(lblPhones); rtbInfo=new RichTextBox(); rtbInfo.Left = 20; rtbInfo.Top = this.Height/3; rtbInfo.Width = this.Width-40; rtbInfo.Lines = strLines; rtbInfo.ReadOnly = true; rtbInfo.Visible = true; this.Controls.Add(rtbInfo); this.Load += new EventHandler(Form_Load); this.Click += new EventHandler(Form_Click); this.Paint += new PaintEventHandler(mypainterhandler); }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Fill; _richTextBox.Multiline = true; _richTextBox.Rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}}{\colortbl ;\red255\green0\blue0;}\viewkind4\uc1\pard\lang2067\b\f0\fs24 Mono\b0 \cf1\fs32 Rocks!\cf0\lang1033\fs24\par}"; Controls.Add (_richTextBox); // // MainForm // ClientSize = new Size (300, 240); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #357155"; Load += new EventHandler (MainForm_Load); }
public Form1() { this.tvpc = new TVPC(512, 512, 32, 32, ScrollConstraint.CenterTile); this.tvpc.padding_px = 0; this.tvpc.Location = new Point(10, 10); //this.tvpc.Anchor = AnchorStyles.Left | AnchorStyles.Right; // Not working right...may indicate a bug in TVPC somewhere... this.tvpc.TabIndex = 0; this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1.Location = new Point(10 + 512 + 10, 10); this.richTextBox1.Size = new System.Drawing.Size(400, 512); this.richTextBox1.BackColor = SystemColors.ControlDark; this.Controls.Add(richTextBox1); stdout = new STDOUT(richTextBox1); // set up printf() for the richTextBox... this.label1 = new Label(); this.label1.BackColor = SystemColors.ControlDark; this.label1.Location = new System.Drawing.Point(12, 512 + 10 + 10); this.label1.Size = new System.Drawing.Size(600, 2 * 13); this.label1.TabIndex = 1; // label1.Text Is set later in Accumulate() this.Controls.Add(this.label1); this.Controls.Add(this.tvpc); this.ClientSize = new System.Drawing.Size(1024, 768); this.Text = "Main Window Title"; this.Shown += this.OnShown; // Will execute once, AFTER Load and Activate events // Note: The order of (Load, Activated, Shown) can be altered, if a MessageBox() is invoked, therefore: do not use MessageBox() this.Paint += this.OnPaint; // Using this to test TileSprite.GDI_Draw_Tile() Application.Idle += Application_Idle; sw.Start(); // start the Stopwatch, which is used to alter the label1.Text via Accumulate() and Animate() // Set up key handling by the Form: // (Some mode-specific key handling may still be done by individual controls) // In addition to the setup here, contained controls (such as this.tvpc) // may need to handle the PreviewKeyDown event, as seen in TVPC.cs OnPreviewKeyDown() this.KeyPreview = true; this.KeyDown += new KeyEventHandler(OnKeyDown); // When additional controls are added into this Form, revisit this if needed... }
public static void WriteLog(RichTextBox _logTextBox, string Text) { string Time = DateTime.Now.ToString("HH:mm:ss dd-MM-yyyy | "); if (_logTextBox.InvokeRequired) { _logTextBox.Invoke(new MethodInvoker(delegate { _logTextBox.AppendText(Time + Text + "\n"); _logTextBox.Select(_logTextBox.Text.LastIndexOf('|'), 1); _logTextBox.SelectionFont = new System.Drawing.Font(_logTextBox.Font.FontFamily, _logTextBox.Font.Size, FontStyle.Bold); _logTextBox.ScrollToCaret(); })); } else { _logTextBox.AppendText(Time + Text + "\n"); _logTextBox.Select(_logTextBox.Text.LastIndexOf('|'), 1); _logTextBox.SelectionFont = new System.Drawing.Font(_logTextBox.Font.FontFamily, _logTextBox.Font.Size, FontStyle.Bold); _logTextBox.ScrollToCaret(); } }
private void InitializeComponent() { this.textBox = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // textBox // this.textBox.Location = new System.Drawing.Point(2, 1); this.textBox.Name = "textBox"; this.textBox.Size = new System.Drawing.Size(236, 243); this.textBox.TabIndex = 0; this.textBox.Text = ""; this.textBox.TextChanged += new System.EventHandler(this.textBox_TextChanged); // // RichTextBoxBordered // this.Controls.Add(this.textBox); this.Name = "RichTextBoxBordered"; this.Size = new System.Drawing.Size(240, 245); this.ResumeLayout(false); }
public RichTextBoxHelper(RichTextBox richTextBox) { this.richTextBox = richTextBox; }
public static void SetRedraw(RichTextBox richTextBox, bool enableRedraw) { const int WM_SETREDRAW = 0x000B; SendMessage(richTextBox.Handle, WM_SETREDRAW, enableRedraw ? 1 : 0, IntPtr.Zero); }
/// <summary> /// Print the content of the RichTextBox /// </summary> /// <param name="printType">Printing type to define how to perform the printing process</param> /// <param name="margins">Page margins or null value for use default margins</param> public static void Print(this RichTextBox richTextBox, PrintType printType, Margins margins) { new RichTextBoxHelper(richTextBox).Print(printType, margins, null); }
public static int GetLastVisibleCharIndex(this RichTextBox richTextBox) { return(RichTextBoxHelper.GetLastVisibleCharIndex(richTextBox)); }
public static int GetFirstVisibleLine(RichTextBox richTextBox) { const int EM_GETFIRSTVISIBLELINE = 0x00CE; return(SendMessage(richTextBox.Handle, EM_GETFIRSTVISIBLELINE, 0, IntPtr.Zero)); }
public static int GetVisibleLines(RichTextBox richTextBox) { Size size = TextRenderer.MeasureText("H", richTextBox.Font); return((int)Math.Ceiling((double)richTextBox.ClientRectangle.Height / size.Height)); }
/// <summary> /// Sets the font name for the selected text of the RichTextBox /// </summary> /// <param name="fontName">Name of the font to use</param> /// <returns>Returns true on success, false on failure</returns> public static bool SelectionFontName(this RichTextBox richTextBox, string fontName) { return(RichTextBoxHelper.SelectionFontName(richTextBox, fontName)); }
public static void SetHScroll(this RichTextBox richTextBox, int position) { RichTextBoxHelper.SetHScroll(richTextBox, position); }
/// <summary> /// Sets the font color for the selected text of the RichTextBox /// </summary> /// <param name="richTextBox">RichTextBox control</param> /// <param name="color">Color to apply</param> /// <returns>Returns true on success, false on failure</returns> public static bool SelectionFontColor(RichTextBox richTextBox, Color color) { return(SetSelectionStyle(richTextBox, color, Color.Empty, CFM_COLOR, 0)); }
public static int GetHScroll(RichTextBox richTextBox) { return(GetScrollPos(richTextBox.Handle, Orientation.Horizontal)); }
public static int GetEventMask(RichTextBox richTextBox) { const int EM_GETEVENTMASK = WM_USER + 59; return(SendMessage(richTextBox.Handle, EM_GETEVENTMASK, 0, IntPtr.Zero)); }
public static void SetEventMask(RichTextBox richTextBox, int mask) { const int EM_SETEVENTMASK = WM_USER + 69; SendMessage(richTextBox.Handle, EM_SETEVENTMASK, 0, (IntPtr)mask); }
private void InitializeComponent() { this.radioButton1 = new RadioButton(); this.radioButton2 = new RadioButton(); this.radioButton3 = new RadioButton(); this.groupBox1 = new GroupBox(); this.richTextBox1 = new RichTextBox(); this.label1 = new Label(); this.label2 = new Label(); this.textBox1 = new TextBox(); this.button1 = new Button(); this.groupBox1.SuspendLayout(); base.SuspendLayout(); this.radioButton1.AutoSize = true; this.radioButton1.Location = new Point(12, 0x1a); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new Size(0x41, 0x11); this.radioButton1.TabIndex = 0; this.radioButton1.Text = "Warning"; this.radioButton1.UseVisualStyleBackColor = true; this.radioButton2.AutoSize = true; this.radioButton2.Checked = true; this.radioButton2.Location = new Point(0x102, 0x1a); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new Size(0x4d, 0x11); this.radioButton2.TabIndex = 1; this.radioButton2.TabStop = true; this.radioButton2.Text = "Information"; this.radioButton2.UseVisualStyleBackColor = true; this.radioButton3.AutoSize = true; this.radioButton3.Location = new Point(0x95, 0x1a); this.radioButton3.Name = "radioButton3"; this.radioButton3.Size = new Size(0x2f, 0x11); this.radioButton3.TabIndex = 2; this.radioButton3.Text = "Error"; this.radioButton3.UseVisualStyleBackColor = true; this.groupBox1.Controls.Add(this.radioButton1); this.groupBox1.Controls.Add(this.radioButton2); this.groupBox1.Controls.Add(this.radioButton3); this.groupBox1.Location = new Point(12, 0x12d); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new Size(0x15b, 0x39); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "Message Type"; this.richTextBox1.Location = new Point(12, 0x4f); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new Size(0x15b, 0xd8); this.richTextBox1.TabIndex = 4; this.richTextBox1.Text = ""; this.label1.AutoSize = true; this.label1.Location = new Point(12, 0x3f); this.label1.Name = "label1"; this.label1.Size = new Size(0x4d, 13); this.label1.TabIndex = 5; this.label1.Text = "Message Text:"; this.label2.AutoSize = true; this.label2.Location = new Point(13, 9); this.label2.Name = "label2"; this.label2.Size = new Size(0x4c, 13); this.label2.TabIndex = 6; this.label2.Text = "Message Title:"; this.textBox1.Location = new Point(12, 0x19); this.textBox1.Name = "textBox1"; this.textBox1.Size = new Size(0x15b, 20); this.textBox1.TabIndex = 7; this.button1.Location = new Point(0xd4, 0x179); this.button1.Name = "button1"; this.button1.Size = new Size(0x93, 0x1d); this.button1.TabIndex = 8; this.button1.Text = "Send Message"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new EventHandler(this.button1_Click); base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; base.ClientSize = new Size(0x16f, 0x19c); base.Controls.Add(this.button1); base.Controls.Add(this.textBox1); base.Controls.Add(this.label2); base.Controls.Add(this.label1); base.Controls.Add(this.richTextBox1); base.Controls.Add(this.groupBox1); base.FormBorderStyle = FormBorderStyle.FixedDialog; base.Name = "message"; this.Text = "Fake Message | LokiRAT"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); base.ResumeLayout(false); base.PerformLayout(); }
/// <summary> /// Sets the background color for the selected text of the RichTextBox /// </summary> /// <param name="richTextBox">RichTextBox control</param> /// <param name="color">Color to apply</param> /// <returns>Returns true on success, false on failure</returns> public static bool SelectionBackColor(RichTextBox richTextBox, Color color) { return(SetSelectionStyle(richTextBox, Color.Empty, color, CFM_BACKCOLOR, 0)); }
public static void ScrollLines(RichTextBox richTextBox, int linesToScroll) { const int EM_LINESCROLL = 0x00B6; SendMessage(richTextBox.Handle, EM_LINESCROLL, 0, (IntPtr)linesToScroll); }
public static void SetEventMask(this RichTextBox richTextBox, int mask) { RichTextBoxHelper.SetEventMask(richTextBox, mask); }
/// <summary> /// Print the content of the RichTextBox /// </summary> /// <param name="printType">Printing type to define how to perform the printing process</param> /// <param name="margins">Page margins or null value for use default margins</param> /// <param name="printType">Delegate invoked before print each page</param> public static void Print(this RichTextBox richTextBox, PrintType printType, Margins margins, BeforePagePrintDelegate beforePagePrintDelegate) { new RichTextBoxHelper(richTextBox).Print(printType, margins, beforePagePrintDelegate); }
public static int GetEventMask(this RichTextBox richTextBox) { return(RichTextBoxHelper.GetEventMask(richTextBox)); }
public static void ScrollLines(this RichTextBox richTextBox, int linesToScroll) { RichTextBoxHelper.ScrollLines(richTextBox, linesToScroll); }
public static void SetRedraw(this RichTextBox richTextBox, bool enableRedraw) { RichTextBoxHelper.SetRedraw(richTextBox, enableRedraw); }
/// <summary> /// Sets the font color for the word in the selected point /// </summary> /// <param name="color">Color to apply</param> /// <returns>Returns true on success, false on failure</returns> public static bool WordFontColor(this RichTextBox richTextBox, Color color) { return(RichTextBoxHelper.WordFontColor(richTextBox, color)); }
/// <summary> /// Sets the background color for the selected text of the RichTextBox /// </summary> /// <param name="color">Color to apply</param> /// <returns>Returns true on success, false on failure</returns> public static bool SelectionBackColor(this RichTextBox richTextBox, Color color) { return(RichTextBoxHelper.SelectionBackColor(richTextBox, color)); }
public static int GetVisibleLines(this RichTextBox richTextBox) { return(RichTextBoxHelper.GetVisibleLines(richTextBox)); }
public static void HideSelection(this RichTextBox richTextBox, bool hide) { RichTextBoxHelper.HideSelection(richTextBox, hide); }
/// <summary> /// Print the content of the RichTextBox /// </summary> /// <param name="printType">Printing type to define how to perform the printing process</param> public static void Print(this RichTextBox richTextBox, PrintType printType) { new RichTextBoxHelper(richTextBox).Print(printType, null, null); }
public InsertCharacterAtCursorInTextBox(RichTextBox richtxtBx) { m_RichTextBox = richtxtBx; }
public static int GetHScroll(this RichTextBox richTextBox) { return(RichTextBoxHelper.GetHScroll(richTextBox)); }
// #endregion [Private Declar] private void Initialize() { #region [declare new] components = new Container(); splitTimer = new Timer(components); split_container = new SplitContainer(); fpanel = new XShadowPanel(); f_inner_panel = new Panel(); btn_list = new OfficeButton(); btn_new = new OfficeButton(); btn_edit = new OfficeButton(); btn_delete = new OfficeButton(); btn_print = new OfficeButton(); btn_splitter = new OfficeButton(); lbl_header = new Label(); btn_close = new Button(); txt_databases_name = new XTextBox(); lbl_databases_name = new XLabel(); txt_notes = new RichTextBox(); lbl_notes = new XLabel(); btn_save = new OfficeButton(); btn_cancel = new OfficeButton(); btn_not_active = new OfficeButton(); btn_active = new OfficeButton(); #endregion [declare new] // #region [container suspend] // ((ISupportInitialize)(split_container)).BeginInit(); split_container.Panel1.SuspendLayout(); split_container.Panel2.SuspendLayout(); split_container.SuspendLayout(); fpanel.SuspendLayout(); f_inner_panel.SuspendLayout(); SuspendLayout(); // #endregion [container suspend] // #region [splitTimer] // splitTimer.Interval = 2; splitTimer.Tick += new EventHandler(SplitTimer_Tick); // #endregion [splitTimer] // #region [split_container] // split_container.Dock = DockStyle.Fill; split_container.Location = new Point(0, 0); split_container.Name = "split_container"; split_container.Size = new Size(Theme.Screen_Width, Theme.Screen_Heigth); split_container.SplitterDistance = Theme.Screen_Width; split_container.TabIndex = 0; // // split_container.Panel1 // split_container.Panel1.Controls.Add(fpanel); split_container.Panel1.BackColor = Theme.Fpanel1_Backcolor; // #region [split_container.Panel2] // split_container.Panel2.BackColor = Theme.Fpanel2_Backcolor; split_container.Panel2.Controls.Add(btn_print); split_container.Panel2.Controls.Add(btn_delete); split_container.Panel2.Controls.Add(btn_edit); split_container.Panel2.Controls.Add(btn_new); split_container.Panel2.Controls.Add(btn_list); split_container.Panel2.Controls.Add(btn_splitter); // btn_list.Font = Theme.btnFont; btn_list.Location = new Point(Theme.F_btn_list_left, Theme.F_btn_list_top); btn_list.Size = new Size(Theme.F_btn_list_width, Theme.F_btn_list_height); btn_list.TabIndex = 1; btn_list.Name = "btn_list"; btn_list.Text = "&List"; btn_list.Themes = Theme.BlueBtn; btn_list.Click += Btn_list_Click; // btn_new.Font = Theme.btnFont; btn_new.Location = new Point(Theme.F_btn_list_left, (btn_list.Bottom + Theme.F_btn_gap)); btn_new.Size = new Size(Theme.F_btn_list_width, Theme.F_btn_list_height); btn_new.TabIndex = btn_list.TabIndex + 1; btn_new.Name = "btn_new"; btn_new.Text = "&New"; btn_new.Themes = Theme.BlueBtn; btn_new.Click += Btn_new_Click; // btn_edit.Font = Theme.btnFont; btn_edit.Location = new Point(Theme.F_btn_list_left, (btn_new.Bottom + Theme.F_btn_gap)); btn_edit.Size = new Size(Theme.F_btn_list_width, Theme.F_btn_list_height); btn_edit.TabIndex = btn_new.TabIndex + 1; btn_edit.Name = "btn_edit"; btn_edit.Text = "&Edit"; btn_edit.Themes = Theme.BlueBtn; btn_edit.Click += Btn_edit_Click; // btn_delete.Font = Theme.btnFont; btn_delete.Location = new Point(Theme.F_btn_list_left, (btn_edit.Bottom + Theme.F_btn_gap)); btn_delete.Size = new Size(Theme.F_btn_list_width, Theme.F_btn_list_height); btn_delete.TabIndex = btn_edit.TabIndex + 1; btn_delete.Name = "btn_delete"; btn_delete.Text = "&Delete"; btn_delete.Themes = Theme.BlueBtn; btn_delete.Click += Btn_delete_Click; // btn_print.Font = Theme.btnFont; btn_print.Location = new Point(Theme.F_btn_list_left, (btn_delete.Bottom + Theme.F_btn_gap)); btn_print.Size = new Size(Theme.F_btn_list_width, Theme.F_btn_list_height); btn_print.TabIndex = btn_delete.TabIndex + 1; btn_print.Name = "btn_print"; btn_print.Text = "&Print"; btn_print.Themes = Theme.BlueBtn; btn_print.Click += Btn_print_Click; // btn_splitter.Font = Theme.btnFont; btn_splitter.Location = new Point(Theme.F_btn_list_left - 30, Theme.F_btn_list_top); btn_splitter.Size = new Size(Theme.F_btn_spliter_width, btn_print.Bottom - btn_list.Top); btn_splitter.TabIndex = btn_print.TabIndex + 1; btn_splitter.Name = "btn_splitter"; btn_splitter.Text = "⁞⁞"; btn_splitter.Themes = Theme.WhiteBtn; btn_splitter.Click += new EventHandler(Btn_splitter_Click); // #endregion [split_container.Panel2] // #endregion [split_container] // #region [fpanel] // fpanel.Name = "fpanel"; fpanel.Anchor = ((AnchorStyles)((AnchorStyles.Top)) | ((AnchorStyles.Right)) | ((AnchorStyles.Left))); fpanel.Controls.Add(f_inner_panel); fpanel.Size = new Size(Theme.Fpanel_width, Theme.Fpanel_height); fpanel.Location = new Point(Theme.Fpanel_left, Theme.Fpanel_top); fpanel.BackColor = Theme.Fpanel_Backcolor; fpanel.TabIndex = 1; // #endregion [fpanel] // #region [f_inner_panel] // f_inner_panel.Anchor = ((AnchorStyles)((AnchorStyles.Top)) | ((AnchorStyles.Right)) | ((AnchorStyles.Left))); f_inner_panel.Cursor = Cursors.Default; f_inner_panel.Name = "f_inner_panel"; f_inner_panel.Size = new Size(Theme.Fpanel_width - 11, Theme.Fpanel_height - 11); f_inner_panel.Location = new Point(6, 0); f_inner_panel.BackColor = Theme.F_inner_panel_Backcolor; f_inner_panel.AutoScroll = true; f_inner_panel.TabIndex = 2; // #region [adding controls] // f_inner_panel.Controls.Add(btn_close); f_inner_panel.Controls.Add(lbl_header); f_inner_panel.Controls.Add(txt_notes); f_inner_panel.Controls.Add(lbl_notes); f_inner_panel.Controls.Add(txt_databases_name); f_inner_panel.Controls.Add(lbl_databases_name); f_inner_panel.Controls.Add(btn_save); f_inner_panel.Controls.Add(btn_cancel); f_inner_panel.Controls.Add(btn_not_active); f_inner_panel.Controls.Add(btn_active); // #endregion [adding controls] // #region [Header] // btn_close.Anchor = AnchorStyles.Top | AnchorStyles.Right; btn_close.BackColor = Color.FromArgb(0, 97, 168); btn_close.Cursor = Cursors.Default; btn_close.FlatAppearance.BorderSize = 0; btn_close.FlatAppearance.MouseDownBackColor = Color.OrangeRed; btn_close.FlatAppearance.MouseOverBackColor = Color.Crimson; btn_close.FlatStyle = FlatStyle.Flat; btn_close.Font = new Font("Arial", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0); btn_close.ForeColor = Color.FromArgb(217, 237, 255); btn_close.Location = new Point(Theme.F_btn_close_left, Theme.F_btn_close_top); btn_close.Name = "btn_close"; btn_close.Size = new Size(Theme.btn_close_width, Theme.btn_close_height); btn_close.TabIndex = 30; btn_close.Text = "X"; btn_close.UseVisualStyleBackColor = false; btn_close.Click += new EventHandler(Btn_close_Click); // lbl_header.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; lbl_header.BackColor = Theme.F_header_Backcolor; lbl_header.Cursor = Cursors.Default; lbl_header.Font = Theme.F_header_Font; lbl_header.ForeColor = Theme.F_headerText_Fontcolor; lbl_header.Location = new Point(-5, 0); lbl_header.Name = "lbl_header"; lbl_header.Size = new Size(Theme.F_header_width, Theme.F_header_height); lbl_header.Text = "Databases"; lbl_header.TextAlign = ContentAlignment.MiddleCenter; // #endregion [Header] // #region [Properties of control] // lbl_databases_name.Font = Theme.Font_10B; lbl_databases_name.ForeColor = Theme.lbl_ForeColor; lbl_databases_name.Location = new Point(Theme.lbl_left, Theme.lbl_top); lbl_databases_name.Size = new Size(Theme.OneLabelColumn, Theme.OneLabelHeight); lbl_databases_name.Name = "lbl_databases_name"; lbl_databases_name.Text = " Databases Name"; lbl_databases_name.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left); lbl_databases_name.TextAlign = ContentAlignment.MiddleLeft; lbl_databases_name.TabIndex = Theme.lbl_TabIndex; // txt_databases_name.Font = Theme.txtFont; txt_databases_name.ForeColor = Theme.txtForeColor; txt_databases_name.BackColor = Theme.txt_Backcolor; txt_databases_name.ReadOnlyBackColor = Theme.txt_Readonly_Backcolor; txt_databases_name.Location = new Point(Theme.txt_left, Theme.txt_top); txt_databases_name.Size = new Size(Theme.OneTextColumn, Theme.txt_Height); txt_databases_name.Name = "txt_databases_name"; txt_databases_name.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right); txt_databases_name.TabIndex = Theme.txt_TabIndex; txt_databases_name.Enter += new EventHandler(Txt_databases_name_Enter); // lbl_notes.Font = Theme.Font_10B; lbl_notes.ForeColor = Theme.lbl_ForeColor; lbl_notes.Location = new Point(Theme.lbl_left, Theme.Fpanel_height - 75); lbl_notes.Size = new Size(Theme.F_lbl_notes_width, Theme.F_lbl_notes_height); lbl_notes.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Bottom); lbl_notes.Name = "lbl_notes"; lbl_notes.Text = " Notes"; lbl_notes.TextAlign = ContentAlignment.MiddleLeft; lbl_notes.TabIndex = lbl_databases_name.TabIndex + 1; lbl_notes.Click += new EventHandler(Lbl_notes_Click); // txt_notes.Font = Theme.txtFont; txt_notes.ForeColor = Theme.txtForeColor; txt_notes.BackColor = Theme.White; txt_notes.Location = new Point(Theme.txt_left, Theme.Fpanel_height - 75); txt_notes.Size = new Size(Theme.F_txt_notes_width, Theme.F_txt_notes_height); txt_notes.Name = "txt_notes"; txt_notes.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right); txt_notes.Enter += new EventHandler(Txt_notes_Enter); // #endregion [Properties of control] // #region [Properties of btn] // btn_save.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); btn_save.Font = Theme.btnFont; btn_save.Size = new Size(Theme.F_btn_width, Theme.F_btn_height); btn_save.Location = new Point(Theme.F_btn_save_left, Theme.F_btn_save_top); btn_save.TabIndex = txt_databases_name.TabIndex + 1; btn_save.Name = "btn_save"; btn_save.Text = "&SAVE"; btn_save.Themes = Theme.BlueBtn; btn_save.Click += new EventHandler(Btn_save_click); // btn_cancel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); btn_cancel.Font = Theme.btnFont; btn_cancel.Size = new Size(Theme.F_btn_width, Theme.F_btn_height); btn_cancel.Location = new Point(Theme.F_btn_cancel_left, Theme.F_btn_cancel_top); btn_cancel.TabIndex = btn_save.TabIndex + 1; btn_cancel.Name = "btn_cancel"; btn_cancel.Text = "&CANCEL"; btn_cancel.Themes = Theme.BlueBtn; btn_cancel.Click += new EventHandler(Btn_cancel_Click); // btn_not_active.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); btn_not_active.Font = Theme.btnFont; btn_not_active.Size = new Size(Theme.F_btn_width, Theme.F_btn_height); btn_not_active.Location = new Point(Theme.F_btn_notactive_left, Theme.F_btn_notactive_top); btn_not_active.TabIndex = btn_cancel.TabIndex + 1; btn_not_active.Name = "btn_not_active"; btn_not_active.Text = "&Not Active"; btn_not_active.Click += new EventHandler(Btn_not_active_Click); // btn_active.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); btn_active.Font = Theme.btnFont; btn_active.Size = new Size(Theme.F_btn_width, Theme.F_btn_height); btn_active.Location = new Point(Theme.F_btn_active_left, Theme.F_btn_active_top); btn_active.TabIndex = btn_not_active.TabIndex + 1; btn_active.Name = "btn_active"; btn_active.Text = "&Active"; btn_active.Click += new EventHandler(Btn_active_Click); // txt_notes.TabIndex = btn_active.TabIndex + 1; // #endregion [Properties of btn] // #endregion [f_inner_panel] // #region [FDatabases] // this.AutoScaleDimensions = new SizeF(6F, 13F); this.AutoScaleMode = AutoScaleMode.Font; this.Controls.Add(this.split_container); this.Name = "fDatabases"; this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, ClientSize.Height); // this.split_container.Panel1.ResumeLayout(false); this.split_container.Panel2.ResumeLayout(false); ((ISupportInitialize)(this.split_container)).EndInit(); this.split_container.ResumeLayout(false); this.fpanel.ResumeLayout(false); this.f_inner_panel.ResumeLayout(false); this.f_inner_panel.PerformLayout(); this.ResumeLayout(false); // #endregion [Fpost] }
/// <summary> /// Sets the font style for the selected text of the RichTextBox /// </summary> /// <param name="fontStyle">Font style to apply to selected text</param> /// <returns>Returns true on success, false on failure</returns> public static bool SelectionFontStyle(this RichTextBox richTextBox, FontStyle fontStyle) { return(RichTextBoxHelper.SelectionFontStyle(richTextBox, fontStyle)); }
/// <summary> /// Sets the font size for the selected text of the RichTextBox /// </summary> /// <param name="fontSize">Font size to use</param> /// <returns>Returns true on success, false on failure</returns> public static bool SelectionFontSize(this RichTextBox richTextBox, int fontSize) { return(RichTextBoxHelper.SelectionFontSize(richTextBox, fontSize)); }
public MainForm () { // // _richTextBox // _richTextBox = new RichTextBox (); _richTextBox.Dock = DockStyle.Top; _richTextBox.Height = 200; Controls.Add (_richTextBox); // // _changeFontButton // _changeFontButton = new Button (); _changeFontButton.Text = "ChangeFont"; _changeFontButton.Dock = DockStyle.Top; _changeFontButton.Click += new EventHandler (ChangeFontButton_Click); Controls.Add (_changeFontButton); // // MainForm // ClientSize = new Size (300, 130); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #351938"; Load += new EventHandler (MainForm_Load); }