请问在CVI环境下怎么实现在鼠标移动到某个控件上时改变形状?
设置一个timer
//determine whether the mouse is on control
int IsClickCtrl (int panel, int control, int x, int y)
{
int height, width;
if ((x < 0) || (y < 0))
return 0;
if (control == 0)
{
GetPanelAttribute (panel, ATTR_HEIGHT, &height);
GetPanelAttribute (panel, ATTR_WIDTH, &width);
}
else
{
GetCtrlAttribute (panel, control, ATTR_HEIGHT, &height);
GetCtrlAttribute (panel, control, ATTR_WIDTH, &width);
}
if ((y < height) && (x < width))
return 1;
else
return 0;
}
在timer函数里面:
/* Change mouse cursor if we are over panel or MESSAGELIST, */
/* and this panel is the active panel. */
if (GetActivePanel() == panel)
{
if (IsClickCtrl (panel, 0, panelX, panelY))
{
if (IsClickCtrl (panel, PANEL_MESSAGEBOX, ctrlX, ctrlY))
SetMouseCursor (VAL_OPEN_HAND_CURSOR);
else
SetMouseCursor (VAL_CROSS_HAIR_CURSOR );
}
else
SetMouseCursor (VAL_DEFAULT_CURSOR);
}
else
SetMouseCursor (VAL_DEFAULT_CURSOR);