private void btnLineDown_MouseDown(object sender, MouseEventArgs e) { ScrollAction = (int)Eclectic.ScrollBarActions.SB_LINEDOWN; tmrScroll.Enabled = true; Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_LINEDOWN, 0); txtPage.Focus(); }
private void DarkTextBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.Control) // handle control key functions { if (FormattingEnabled) // handle formating keys if formatting enabled { if (e.KeyCode == Keys.B) { if (this.SelectionFont.Bold) { this.SelectionFont = new Font(this.SelectionFont, FontStyle.Regular); } else { this.SelectionFont = new Font(this.SelectionFont, FontStyle.Bold); } } else if (e.KeyCode == Keys.J) { Eclectic.SendMessage(Handle, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY); } } else // supress formating if formatting disabled { if (e.KeyCode == Keys.L || e.KeyCode == Keys.E || e.KeyCode == Keys.R || e.KeyCode == Keys.Oem2 || e.KeyCode == Keys.Oem1) { e.Handled = true; } } } else // handle if control not pressed { // handle new line if (e.KeyCode == Keys.Enter) { // handle autoindent if (AutoIndent & SelectionStart != 0) { SelectedText = "\n" + findIndentLevel(); e.Handled = true; } } // handle tabs to spaces if (e.KeyCode == Keys.Tab) { if (TabsToSpaces > 0) { SendKeys.Send("{BACKSPACE}"); for (int i = 0; i < TabsToSpaces; i++) { SendKeys.Send(" "); } } tabCount++; } } }
private void txtPage_MouseWheel(object sender, MouseEventArgs e) { if (e.Delta > 0) { Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_LINEUP, 0); } else { Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_LINEDOWN, 0); } }
private void Init() { Int32 lStyle; lStyle = (int)Eclectic.TextMode.TM_RICHTEXT | (int)Eclectic.TextMode.TM_MULTILEVELUNDO | (int)Eclectic.TextMode.TM_MULTICODEPAGE; Eclectic.SendMessage(txtPage.Handle, Eclectic.EM_SETTEXTMODE, lStyle, 0); Sync(); switch (Properties.Settings.Default.DataRecoveryMode) { case (int)Eclectic.DataRecoveryModes.BUFFER: txtPage.Text = RecallCache(); break; case (int)Eclectic.DataRecoveryModes.LAST_FILE: OpenFile(Properties.Settings.Default.LastFileName); break; } txtPage.Select(0, 0); txtPage.ContextMenuStrip = contextMenuPage; txtPage.DetectUrls = txtPage.FormattingEnabled; txtPage.AutoIndent = Properties.Settings.Default.AutoIndent; txtPage.TabsToSpaces = Properties.Settings.Default.TabToSpaces; txtPage.ClearUndo(); txtPage.Modified = false; dlgOpen.Filter = "Text Documents (*.txt)|*.txt|All files (*.*)|*.*"; dlgSave.Filter = "Text Documents (*.txt)|*.txt"; if (txtPage.FormattingEnabled) { dlgOpen.Filter = "Rich Text Format (*.rtf)|*.rtf|" + dlgOpen.Filter; dlgSave.Filter = "Rich Text Format (*.rtf)|*.rft|" + dlgSave.Filter; } dlgSave.AddExtension = true; preferencesToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+,"; statisticsToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+/"; }
private void tmrScroll_Tick(object sender, EventArgs e) { switch (ScrollAction) { case (int)Eclectic.ScrollBarActions.SB_LINEDOWN: Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_LINEDOWN, 0); break; case (int)Eclectic.ScrollBarActions.SB_PAGEDOWN: Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_PAGEDOWN, 0); break; case (int)Eclectic.ScrollBarActions.SB_LINEUP: Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_LINEUP, 0); break; case (int)Eclectic.ScrollBarActions.SB_PAGEUP: Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_PAGEUP, 0); break; } }
private void btnPageDown_Click(object sender, EventArgs e) { ScrollAction = (int)Eclectic.ScrollBarActions.SB_PAGEDOWN; Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_PAGEDOWN, 0); txtPage.Focus(); }
private void btnPageUp_Click(object sender, EventArgs e) { ScrollAction = (int)Eclectic.ScrollBarActions.SB_PAGEUP; Eclectic.SendMessage(txtPage.Handle, Eclectic.WM_VSCROLL, (int)Eclectic.ScrollBarActions.SB_PAGEUP, 0); }