BCB的判断鼠标的位置的,在Timer中判断!可以设置Timer的interval=100void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
RECT rc;
TPoint pt;
GetWindowRect(Handle,&rc);
GetCursorPos(&pt);
if(PtInRect(&rc,pt))
{
调用鼠标移入市的你的操作
}
//mouse leave window
else
{
调用鼠标移出市的你的操作
}
}
{
RECT rc;
TPoint pt;
GetWindowRect(Handle,&rc);
GetCursorPos(&pt);
if(PtInRect(&rc,pt))
{
调用鼠标移入市的你的操作
}
//mouse leave window
else
{
调用鼠标移出市的你的操作
}
}
Flat风格我不知道procedure TForm1.Timer1Timer(Sender: TObject);
var
rc:TRect;
pt:TPoint;
begin
GetWindowRect(Memo1.Handle ,rc);
GetCursorPos(pt);
if (PtInRect(rc,pt)) then
begin
Label1.Caption :='MouseIn';
end
else
begin
Label1.Caption :='MouseOut';
endend;
谢谢!
但我不能实现的就是FLAT风格啊:)
哈哈,正如老兄所言!
不过TListView却是可以的。
-------------
你可有什么办法使MEMO也像这样呢?
InitializeFlatSB, FlatSB_SetScrollProp,FlatSB_ShowScrollBarCREATE时:
InitializeFlatSB(Handle);设为FLAT的时:
FlatSB_SetScrollProp(Handle, WSB_PROP_HSTYLE, FSB_FLAT_MODE, True);
FlatSB_SetScrollProp(Handle, WSB_PROP_VSTYLE, FSB_FLAT_MODE, True);
if GetScrollRange(Handle, SB_VERT, nMin, nMax) then
FlatSB_SetScrollRange(Handle, SB_VERT, nMin, nMax, True);
if GetScrollRange(Handle, SB_HORZ, nMin, nMax) then
FlatSB_SetScrollRange(Handle, SB_HORZ, nMin, nMax, True);
FlatSB_SetScrollPos(Handle, SB_HORZ, GetScrollPos(Handle, SB_HORZ), True);
FlatSB_SetScrollPos(Handle, SB_VERT, GetScrollPos(Handle, SB_VERT), True);
FlatSB_ShowScrollBar(Handle, SB_VERT, True);剩下的自己研究,看看 API