在MouseMove
事件我需要在列表視圖中選擇項目,如果我的鼠標點擊拖動它們。我的代碼不起作用。當我點擊並只拖動第一個項目時,我點擊被選中。選擇Listitems拖動不工作
在MouseMove
事件:
//If left mouse button is depressed
if(GetAsyncKeyState(VK_LBUTTON) = 1) then
begin
LListItem := NestingResultsListView.GetItemAt(x,y);
//If the item is not selected, select it.
if not LListItem.Selected then
begin
LListItem.Selected := true;
end;
end;
你的意思是'GetKeyState'而不是'GetAsyncKeyState'。不是我認爲這是做到這一點的方法,但是如果您要在鼠標移動事件中調用其中一個函數,它將是'GetKeyState'。 –
OP使用'GetAsyncKeyState',我的意思是它也。而且我在GetKeyState文檔中沒有找到它支持鼠標按鈕的方法,但它明確指出了'GetAsyncKeyState'。 – Inspired
OP很可能使用'GetAsyncKeyState',但你認爲這是正確的做法嗎?是的,您可以將'VK_LBUTTON'傳遞給'GetKeyState'。我希望看到你解決這個問題。 –