Takeshi SHIGIHARA
2006-06-07 05:38:18 UTC
$B4D6-$O(BVisual Studio .NET 2003$B!"(BC# 1.1 $B$G$9!#(B
$B8=:_$N$H$3$m!"(BWindows(2K,XP)$B0J30$G$NF0:n$O9M$($F$$$^$;$s!#(B
$B<ALd(B
TextBox$B$K$*$$$F!"%-%c%l%C%H0LCV$r;XDj$7!"$=$3$+$i7h$^$C$?(B
$BJ}8~$KA*Br$r5/$3$7$?$$$N$G$9$,!"$=$NJ}K!$O!)(B
$B>\:Y(B
System.Windows.Forms.TextBox$B$K$*$$$F!"J8;zNs(B ABCDEFGHI $B$r(B
$BI=<($7$F$$$k$b$N$H$7$^$9!#(B
$B$3$3$G!"(B E$B$H(BF$B$N4V$K%-%c%l%C%H$rCV$-!"KvHx$^$G!"$D$^$j(BFGHI
$B$rA*Br>uBV$H$7$?$j!"5U$K(B BCDE $B$rA*Br>uBV$H$7$?$$$N$G$9$,(B
$B$I$&$K$b$d$jJ}$,J,$+$i$:$K:$$C$F$$$^$9!#(B
Win32/SDK$B$G$N(B EM_SETSEL $B$N$h$&$K!"A*Br3+;O0LCV$H=*N;0LCV$r(B
$BM?$($kJ}K!$,$"$l$PNI$$$N$G$9$,!"(BTextBox$B$G;HMQ$G$-$=$&$J(B
$B4X?t!"%W%m%Q%F%#$O(B
SelectionLength $B%W%m%Q%F%#(B
SelectionStart $B%W%m%Q%F%#(B
SelectedText $B%W%m%Q%F%#(B
Select(int start, int length) $B%a%=%C%I(B
$B$J$I$,8+Ev$?$k$P$+$j$G!"$I$&$b;W$C$?$h$&$KA*Br$9$kJ}8~$r(B
$B@)8f$G$-$=$&$K$"$j$^$;$s!#(B
static readonly uint EM_SETSEL = 0x00B1;
[System.Runtime.InteropServices.DllImport("User32.dll")]
static extern UInt32 SendMessage(IntPtr hwnd, uint msg, uint wparam, uint lparam);
public void SetSel(uint start, uint end)
{
SendMessage(this.Handle, EM_SETSEL, start, end);
}
$B$N$h$&$K$G$b$7$F!"(BWindows$B5!G=$rD>@\8F$S=P$9$[$+$O$J$$(B
$B$N$G$7$g$&$+!#(B
----- Takeshi SHIGIHARA
***@tka.att.ne.jp
***@po.jah.ne.jp -----
$B$&$^$$!"Aa$$!"0B$$!?#2$D$@$1A*$Y(B--RFC1925.
$B8=:_$N$H$3$m!"(BWindows(2K,XP)$B0J30$G$NF0:n$O9M$($F$$$^$;$s!#(B
$B<ALd(B
TextBox$B$K$*$$$F!"%-%c%l%C%H0LCV$r;XDj$7!"$=$3$+$i7h$^$C$?(B
$BJ}8~$KA*Br$r5/$3$7$?$$$N$G$9$,!"$=$NJ}K!$O!)(B
$B>\:Y(B
System.Windows.Forms.TextBox$B$K$*$$$F!"J8;zNs(B ABCDEFGHI $B$r(B
$BI=<($7$F$$$k$b$N$H$7$^$9!#(B
$B$3$3$G!"(B E$B$H(BF$B$N4V$K%-%c%l%C%H$rCV$-!"KvHx$^$G!"$D$^$j(BFGHI
$B$rA*Br>uBV$H$7$?$j!"5U$K(B BCDE $B$rA*Br>uBV$H$7$?$$$N$G$9$,(B
$B$I$&$K$b$d$jJ}$,J,$+$i$:$K:$$C$F$$$^$9!#(B
Win32/SDK$B$G$N(B EM_SETSEL $B$N$h$&$K!"A*Br3+;O0LCV$H=*N;0LCV$r(B
$BM?$($kJ}K!$,$"$l$PNI$$$N$G$9$,!"(BTextBox$B$G;HMQ$G$-$=$&$J(B
$B4X?t!"%W%m%Q%F%#$O(B
SelectionLength $B%W%m%Q%F%#(B
SelectionStart $B%W%m%Q%F%#(B
SelectedText $B%W%m%Q%F%#(B
Select(int start, int length) $B%a%=%C%I(B
$B$J$I$,8+Ev$?$k$P$+$j$G!"$I$&$b;W$C$?$h$&$KA*Br$9$kJ}8~$r(B
$B@)8f$G$-$=$&$K$"$j$^$;$s!#(B
static readonly uint EM_SETSEL = 0x00B1;
[System.Runtime.InteropServices.DllImport("User32.dll")]
static extern UInt32 SendMessage(IntPtr hwnd, uint msg, uint wparam, uint lparam);
public void SetSel(uint start, uint end)
{
SendMessage(this.Handle, EM_SETSEL, start, end);
}
$B$N$h$&$K$G$b$7$F!"(BWindows$B5!G=$rD>@\8F$S=P$9$[$+$O$J$$(B
$B$N$G$7$g$&$+!#(B
----- Takeshi SHIGIHARA
***@tka.att.ne.jp
***@po.jah.ne.jp -----
$B$&$^$$!"Aa$$!"0B$$!?#2$D$@$1A*$Y(B--RFC1925.