파일 이름의 목록 상자에있는 항목 위에 마우스를 올려 놓으면 미리보기 이미지 (힌트와 비슷 함)를 표시하려면 어떻게해야합니까? 양식을 보여주고 이미지를로드하려고 시도했지만 미리보기 양식이 표시 될 때 목록 상자의 포커스를 잃습니다. 즉, 마우스를 움직이면 목록의 다음 항목으로 이동하면 미리보기 이미지가 변경되지 않습니다. .목록 상자의 이미지 미리보기
감사합니다. Pieter.
나는, TOndrej의 답변에 따라, 사용자 정의 THintWindow을 구현하려고 노력하지만, Canvas.StretchDraw 매개 변수로 전송되는 비트 맵을 그릴하지 않습니다. 어떤 아이디어가 좋을까요? 텍스트가 정상적으로 표시됩니다.
procedure TFormMain.DisplayPreview(HintImage: TBitmap);
var
CustomHint: THintWindow;
Rect: TRect;
MousePoint: TPoint;
begin
*{
Based on Source: http://www.chami.com/tips/delphi/112996D.html
}*
GetCursorPos(MousePoint);
with Rect do
begin
// set the position and size of the hint window
Left := MousePoint.X;
Top := MousePoint.Y;
Right := Left + 50;
Bottom := Top + 25;
end;
CustomHint := THintWindow.Create(Self);
try
with CustomHint do
begin
// set the background color
//Color := clNone;
**Canvas.StretchDraw(Rect, HintImage);**
ActivateHint(Rect, 'Hint');
Application.ProcessMessages;
//
// perform your tasks here
// before closing the hint window
//
Sleep(500);
ReleaseHandle;
end;
finally
if Assigned(CustomHint) then
CustomHint.Free;
end;
end;