質問編集履歴

1

試したことを追記しました。

2016/08/06 04:49

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -44,4 +44,62 @@
44
44
 
45
45
 
46
46
 
47
+ 試した内容は下記になります。
48
+
49
+
50
+
51
+ ```ここに言語を入力
52
+
53
+ public partial class MainWindow : Window
54
+
55
+ {
56
+
57
+
58
+
59
+ [System.Runtime.InteropServices.DllImport("user32")]
60
+
61
+ private static extern IntPtr SendMessage(IntPtr hWnd, int msgId, IntPtr wParam, EditWordBreakProc lParam);
62
+
63
+ private delegate int EditWordBreakProc(IntPtr ipch, int ichCurrent, int cch, int code);
64
+
65
+
66
+
67
+ public MainWindow()
68
+
69
+ {
70
+
71
+ InitializeComponent();
72
+
73
+
74
+
75
+ HwndSource source = (HwndSource)HwndSource.FromVisual(textBox);
76
+
77
+ const int EM_SETWORDBREAKPROC = 0xD0;
78
+
79
+ SendMessage(source.Handle, EM_SETWORDBREAKPROC, IntPtr.Zero, delegate { return 0; });
80
+
81
+
82
+
83
+ }
84
+
85
+
86
+
87
+ }
88
+
89
+ ```
90
+
91
+
92
+
93
+
94
+
95
+ 上記のソースコードですとsourceがnullになってしまい
96
+
97
+ 型 'System.NullReferenceException' の例外がでてしまいます。
98
+
99
+
100
+
101
+ wpfのTextBoxが単語ごとに改行ではなく、端まできたら改行するソースコードを探しております。
102
+
103
+
104
+
47
105
  皆様ご教授よろしくお願い致します。