9.键盘鼠标和文件编程 怎么进入编程界面( 三 )


例3:在屏幕上输出按键操作的结果,包括Shift、Alt、Ctrl键 。界面如下:

9.键盘鼠标和文件编程 怎么进入编程界面


示例代码:
过程TForm1 。FormKeyDown(发送方:TObjectvar键:WordShift:TShiftState);开始标签1 。标题:= & # 39;';if Shift & gt;= [ssShift]然后Label1 。标题:= & # 39;Shift & # 39;if Shift & gt;= [ssAlt]然后Label1 。标题:= & # 39;Alt & # 39;if Shift & gt;= [ssCtrl]然后Label1 。标题:= & # 39;Ctrl & # 39;Label1 。标题:= Label1 。caption inttostr(key);end;
,

推荐阅读