Changeset 13 for Common/RichTextBoxEx.cs
- Timestamp:
- Feb 8, 2021, 4:23:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/RichTextBoxEx.cs
r1 r13 1 using System;1 using System; 2 2 using System.Collections.Generic; 3 using System.ComponentModel;4 using System.Data;5 3 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 4 using System.Runtime.InteropServices; 9 5 using System.Windows.Forms; 10 6 … … 66 62 List<string> linkMatchStartString = new List<string>(); 67 63 foreach (var linkMatch in linkMatches) 68 linkMatchStartString.Add(linkMatch.startString.ToLower ());64 linkMatchStartString.Add(linkMatch.startString.ToLowerInvariant()); 69 65 70 66 string content = richTextBox.Text; 71 string contentLowerCase = content.ToLower ();67 string contentLowerCase = content.ToLowerInvariant(); 72 68 73 69 RichTextBox tempRichTextBox = new RichTextBox(); … … 149 145 } 150 146 151 [ System.Runtime.InteropServices.DllImport("user32.dll")]147 [DllImport("user32.dll")] 152 148 private static extern int SendMessage(IntPtr hwndLock, Int32 wMsg, Int32 wParam, Int32 lParam); 153 149 … … 192 188 RichTextBoxContext context = new RichTextBoxContext(); 193 189 context.SaveContext(this); 194 //SelectionStart = 0; 195 SelectAll(); 196 SelectedRtf = previousRtf; 190 Rtf = previousRtf; 197 191 UndoUnknownActions(); 198 192 … … 279 273 if (link != "") 280 274 { 281 int number;282 275 foreach (var linkMatch in linkMatches) 283 276 { 284 277 if ((link.Length >= linkMatch.startString.Length) && ( 285 278 (linkMatch.caseSensitive && (link.Substring(0, linkMatch.startString.Length) == linkMatch.startString)) || 286 (!linkMatch.caseSensitive && (link.ToLower ().Substring(0, linkMatch.startString.Length) == linkMatch.startString.ToLower()))))279 (!linkMatch.caseSensitive && (link.ToLowerInvariant().Substring(0, linkMatch.startString.Length) == linkMatch.startString.ToLower())))) 287 280 { 288 281 string linkNumber = link.Substring(linkMatch.startString.Length).Trim(new char[] { ' ', '#' }); 289 if (int.TryParse(linkNumber, out number))282 if (int.TryParse(linkNumber, out int number)) 290 283 { 291 284 linkMatch.ExecuteLinkAction(number); … … 314 307 StartPosition = FormStartPosition.CenterScreen, 315 308 }; 316 textForm.Icon = Icon.ExtractAssociatedIcon(Application.Execut ablePath);309 textForm.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); 317 310 RichTextBoxEx richTextBox = new RichTextBoxEx(); 318 311 richTextBox.parentForm = textForm; … … 446 439 formFind = new FormFind(); 447 440 formFind.richTextBox = this; 448 formFind.Owner = this.parentForm;441 formFind.Owner = parentForm; 449 442 } 450 443 formFind.Show(); … … 463 456 cms.Items.Add(tsmiShowInWindow); 464 457 465 cms.Opening += delegate (object sender, CancelEventArgs e)458 cms.Opening += delegate 466 459 { 467 460 HideLinks(); … … 481 474 private int oldLength; 482 475 483 [ System.Runtime.InteropServices.DllImport("user32.dll")]484 private extern staticIntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);485 [ System.Runtime.InteropServices.DllImport("user32.dll")]476 [DllImport("user32.dll")] 477 private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); 478 [DllImport("user32.dll")] 486 479 private static extern int SendMessage(IntPtr hwndLock, Int32 wMsg, Int32 wParam, ref Point pt); 487 [ System.Runtime.InteropServices.DllImport("User32.dll")]488 extern staticint GetScrollPos(IntPtr hWnd, int nBar);489 [ System.Runtime.InteropServices.DllImport("user32.dll")]480 [DllImport("User32.dll")] 481 static extern int GetScrollPos(IntPtr hWnd, int nBar); 482 [DllImport("user32.dll")] 490 483 static extern int SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw); 491 484 … … 542 535 public void ExecuteLinkAction(int number) 543 536 { 544 LinkAction (number);537 LinkAction?.Invoke(number); 545 538 } 546 539 … … 573 566 number = content.Substring(numberStart, i); 574 567 575 int intNumber = 0; 576 if (int.TryParse(number, out intNumber)) 568 if (int.TryParse(number, out int intNumber)) 577 569 { 578 570 linkLength += number.Length;
Note:
See TracChangeset
for help on using the changeset viewer.