[C / C ] 单击开发-C – 鼠标事件在开发-C

在本文中,我将带领上的一些功能和事件点击模式 DEV-C 图形.

无效getmouseclick( INT样, INT& X, INT& 和 );
-> 获得的坐标x,和 ( 以像素为单位) 在哪里可以点击
布尔ismouseclick( INT样 );
-> 如果有一个点击返回真
INT mousex( ); -> 鼠标的X坐标
INT像老鼠( ); -> 鼠标坐标y轴

WM_MOUSEMOVE : 移动鼠标在图形显示时,赶上活动
WM_LBUTTONDBLCLK : 当双击鼠标左键捕捉事件
WM_LBUTTONDOWN : 点击鼠标左键的时候赶上事件
WM_LBUTTONUP : 按下鼠标左键后发布的时候赶上事件
类似小鼠和大鼠已之间
WM_MBUTTONDBLCLK
WM_MBUTTONDOWN
WM_MBUTTONUP
WM_RBUTTONDBLCLK
WM_RBUTTONDOWN
WM_RBUTTONUP

有你在这里看到许多其他的功能: http://www.cs.colorado.edu/~main/bgi/doc/

一个代码片段说明离开捕捉鼠标事件, 权.

#include <winbgim.h>
#include <stdio.h>
#include <string.h>

int main(){
	setbkcolor(1);
	int x, y;
	initwindow(800,500);
    setbkcolor(15);
   	cleardevice();
	while (1){
		delay(0.0001);

		if (ismouseclick(WM_LBUTTONDOWN)){
			getmouseclick(WM_LBUTTONDOWN, x, y);
			printf("left click : (%d,%d)n", x, y);
		}

		if (ismouseclick(WM_LBUTTONUP)){
			getmouseclick(WM_LBUTTONUP, x, y);
			printf("left up click : (%d,%d)n", x, y);
		}

		if (ismouseclick(WM_LBUTTONDBLCLK)){
			getmouseclick(WM_LBUTTONDBLCLK, x, y);
			printf("left double click : (%d,%d)n", x, y);
		}

		if (ismouseclick(WM_RBUTTONDOWN)){
			getmouseclick(WM_RBUTTONDOWN, x, y);
			printf("right click : (%d,%d)n", x, y);
		}

		if (ismouseclick(WM_RBUTTONUP)){
			getmouseclick(WM_RBUTTONUP, x, y);
			printf("right up click : (%d,%d)n", x, y);
		}

		if (ismouseclick(WM_RBUTTONDBLCLK)){
			getmouseclick(WM_RBUTTONDBLCLK, x, y);
			printf("right double click : (%d,%d)n", x, y);
		}
		if (ismouseclick(WM_MOUSEMOVE)){
			getmouseclick(WM_MOUSEMOVE, x, y);
			printf("move : (%d,%d)n", x, y);
		}
	}
	system("pause");
	closegraph();
}

结果点击和移动鼠标在图形显示:
鼠标事件在开发-C
视频我来了直线绘制鼠标,但还没有准备好错误:

参考: 在开发-C图形