Form是不能移动的;一般的程序也没有移动的必要;是不是要移动Form中的控件
下面的代码是Handera的例程序的一个函数,你可以参考一下他的例程序;它可以移动控件;Form的移动道理一样,擦掉再重新画。滚动条的相应实现就靠你自己相应消息了;/***********************************************************************
*
* FUNCTION: PrvMoveObject
*
* DESCRIPTION: This routine moves an object vertically within a form.
*
* PARAMETERS:
*
* RETURNED: nothing
*
***********************************************************************/
static void PrvMoveObject(FormPtr frmP, UInt16 objIndex, Coord y_diff, Boolean draw)
{
RectangleType r;
FrmGetObjectBounds(frmP, objIndex, &r);
if (draw)
{
RctInsetRectangle(&r, -2); //need to erase the frame as well
WinEraseRectangle(&r, 0);
RctInsetRectangle(&r, 2);
}
r.topLeft.y += y_diff;
FrmSetObjectBounds(frmP, objIndex, &r);
}
atsea 编辑于 2003-6-3 9:41:27