Hi Nigel,
Here is the code that I have put in OnKeyDown event of ImageEn.
procedure TMDIChild.ImageEnView1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
Result: Boolean;
begin
Result := GetKeyState(VK_SHIFT) < 0;
if Result then
begin
if ImageEnView1.LayersCurrent > 0 then
begin
if GetKeyState(VK_LEFT) < 0 then
begin
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosX :=
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosX - 10;
end;
if GetKeyState(VK_RIGHT) < 0 then
begin
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosX :=
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosX + 10;
end;
if GetKeyState(VK_UP) < 0 then
begin
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosY :=
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosY - 10;
end;
if GetKeyState(VK_DOWN) < 0 then
begin
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosY :=
ImageEnView1.Layers[ImageEnView1.LayersCurrent].PosY + 10;
end;
ImageEnView1.Update;
end;
end;
end;
I debugged code and it is working fine. But nothing is happening visibly in the control on screen. I mean the layer is not moving on screen.
What must be wrong?
TIA
Yogi Yang