hhylly 发表于 2006-5-26 00:02

怎么判断是左建还是右建,点击?

谢谢哦

Knocker 发表于 2006-5-26 09:50

MouseDown事件处理一下<BR><BR>void __fastcall TForm1::Memo1MouseDown(TObject *Sender,<BR>      TMouseButton Button, TShiftState Shift, int X, int Y)<BR>{<BR>           if ( Shift.Contains(ssLeft) )<BR>           {<BR>               ShowMessage("你按下了鼠标左键!");<BR>           }<BR>           if ( Shift.Contains(ssRight) )<BR>           {<BR>               ShowMessage("你按下了鼠标右键!");<BR>           }<BR>}

vfdff 发表于 2006-6-15 01:35

请 问你的是什么语言编写的??

vfdff 发表于 2006-8-11 12:47

<P>如果是用 C 的话 <BR>可以使用 bioskey(2) 判断状态 <BR><BR> 2 查询当前移位状态.状态只有下列值相或得到:<BR>                第7位 0x80  Insert     ON<BR>                第6位 0x40  CapsLock   ON<BR>                第5位 0x20  NumLock    ON<BR>                第4位 0x10  ScrollLock ON<BR>                第3位 0x08  Alt        ON<BR>                第2位 0x04  Ctrl       ON<BR>                第1位 0x02  左Shift    ON<BR>                第0位 0x01  右Shift    ON</P>
<P>程序例:</P>
<P>#include &lt;stdio.h&gt; <BR>#include &lt;bios.h&gt; <BR>#include &lt;ctype.h&gt; </P>
<P>#define RIGHT  0x01 <BR>#define LEFT   0x02 <BR>#define CTRL   0x04 <BR>#define ALT    0x08 </P>
<P>int main(void) <BR>{ <BR>   int key, modifiers; </P>
<P>   /* function 1 returns 0 until a key is pressed */ <BR>   while (bioskey(1) == 0); </P>
<P>   /* function 0 returns the key that is waiting */ <BR>   key = bioskey(0); </P>
<P>   /* use function 2 to determine if shift keys were used */ <BR>   modifiers = bioskey(2); <BR>   if (modifiers) <BR>   { <BR>      printf("["); <BR>      if (modifiers &amp; RIGHT) printf("RIGHT"); <BR>      if (modifiers &amp; LEFT)  printf("LEFT"); <BR>      if (modifiers &amp; CTRL)  printf("CTRL"); <BR>      if (modifiers &amp; ALT)    printf("ALT"); <BR>      printf("]"); <BR>   } <BR>   /* print out the character read */ <BR>   if (isalnum(key &amp; 0xFF)) <BR>      printf("'%c'\n", key); <BR>   else <BR>      printf("%#02x\n", key); <BR>   return 0; <BR>} </P>

dugujian85 发表于 2006-8-22 19:04

我个人的意见是:<BR>void __fastcall TForm1::Memo1MouseDown(TObject *Sender,<BR>      TMouseButton Button, TShiftState Shift, int X, int Y)<BR>{<BR>    if(Button==mbLeft)<BR>       <BR>    { <BR>        //你要做出的处理<BR>    }<BR>    if(Button==mbRight)<BR>    {<BR>          //你要的处理<BR>    }<BR>}<BR>

页: [1]

编程论坛