delphi如何利用键盘移动图片啊? Timage控件没有找到键盘按下的onkeydown事件。我想利用 上下左右方向键控制Timage控件的移动!

解决方案 »

  1.   

    似乎只有这用窗口的KeyDown事件,这里面也是这么讲:
    http://www.delphipages.com/forum/showthread.php?t=112000再找找看。
      

  2.   

    http://delphi.about.com/od/objectpascalide/a/keyboard_events.htm
    这里面也明确说了因为TImage,TPaintBox, TPanel and TLabel不能或者焦点,所以没有KeyPress事件,解决办法还是设置窗口的KeyPreview属性为True,然后在窗口的OnKeyDown处理。Some components, such as TImage, TPaintBox, TPanel and TLabel cannot receive focus. In general, components derived from TGraphicControl are unable to receive focus. Additionally, components that are invisible at run time (TTimer) cannot receive focus.