📄 chap33.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>OnMouseMove事件的处理</title>
<link rel="stylesheet" href="../../../include/style.css">
</head>
<body>
<font SIZE="2">
<p><small><a href="../../../index.htm">首页</a> >> <a href="../../program.htm">程序设计</a>
>> <a href="../cbuilder.htm">C++ Builder</a> >> </small><font>具体而微的绘图程式</font>·OnMouseMove事件的处理</p>
<p align="left"><!--webbot bot="ImageMap" rectangle="(40,1) (71, 23) chap34.htm" rectangle="(4,1) (36, 23) chap32.htm" src="../ch1/NextBack.gif" width="72" height="24" alt="NextBack.gif (743字节)" border="0" startspan --><MAP NAME="FrontPageMap"><AREA SHAPE="RECT" COORDS="40, 1, 71, 23" HREF="chap34.htm"><AREA SHAPE="RECT" COORDS="4, 1, 36, 23" HREF="chap32.htm"></MAP><a href="../../../_vti_bin/shtml.exe/program/C++/ch3/chap33.htm/map"><img ismap usemap="#FrontPageMap" border="0" height="24" alt="NextBack.gif (743字节)" src="../ch1/NextBack.gif" width="72"></a><!--webbot bot="ImageMap" endspan i-checksum="23186" --></p>
</font><p><font SIZE="2"></font><font color="#FF0000" SIZE="2">·02-02 OnMouseMove事件的处理</font></p><font SIZE="2">
<p> </p>
<p>在加上了<font SIZE="2">OnMouseDown</font>及<font SIZE="2">OnMouseUp</font>处理函式之後,我们只能画出一条条直线,若是我们想要以滑鼠画出不规则线段时,就必须再处理<font SIZE="2">OnMouseMove</font>事件,利用<font SIZE="2">OnMouseMove</font>事件,我们可以追纵到滑鼠移动的位置,简单的<font SIZE="2">OnMouseMove</font>事件处理函式如下:</p>
<p> </p>
<font SIZE="2">
<p>void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X,</p>
<p>int Y)</p>
<p>{</p>
<p>Canvas->LineTo(X,Y);</p>
<p>}</p>
</font>
<p>此程式的意义即在於将滑鼠所经过的每个点,以线条连接起来,在加上OnMouseMove
事件处理函式之後,它的执行结果会变成图02:</p>
<p><img SRC="Image9.gif" WIDTH="348" HEIGHT="240">图02</p>
<p align="right"><!--webbot bot="ImageMap" rectangle="(40,1) (71, 23) chap34.htm" rectangle="(4,1) (36, 23) chap32.htm" src="../ch1/NextBack.gif" width="72" height="24" alt="NextBack.gif (743字节)" border="0" startspan --><MAP NAME="FrontPageMap1"><AREA SHAPE="RECT" COORDS="40, 1, 71, 23" HREF="chap34.htm"><AREA SHAPE="RECT" COORDS="4, 1, 36, 23" HREF="chap32.htm"></MAP><a href="../../../_vti_bin/shtml.exe/program/C++/ch3/chap33.htm/map1"><img ismap usemap="#FrontPageMap1" border="0" height="24" alt="NextBack.gif (743字节)" src="../ch1/NextBack.gif" width="72"></a><!--webbot bot="ImageMap" endspan i-checksum="41573" --></p>
<p> <font SIZE="2"><small><a href="../../../index.htm">首页</a> >> <a href="../../program.htm">程序设计</a>
>> <a href="../cbuilder.htm">C++ Builder</a> >> </small><font>具体而微的绘图程式</font></font>·OnMouseMove事件的处理</p>
</font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -