本文整理匯總了C#中Qyoto.QRect.MoveCenter方法的典型用法代碼示例。如果您正苦於以下問題:C# QRect.MoveCenter方法的具體用法?C# QRect.MoveCenter怎麽用?C# QRect.MoveCenter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Qyoto.QRect
的用法示例。
在下文中一共展示了QRect.MoveCenter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: targetRect
private QRect targetRect()
{
QRect result = new QRect(0, 0, 20, 10);
result.MoveCenter(new QPoint(target.X(), Height() - 1 - target.Y()));
return result;
}
示例2: shotRect
private QRect shotRect()
{
const double gravity = 4;
double time = timerCount / 20.0;
double velocity = shootForce;
double radians = shootAngle * 3.14159265 / 180;
double velx = velocity * Math.Cos(radians);
double vely = velocity * Math.Sin(radians);
double x0 = (barrelRect.Right() + 5) * Math.Cos(radians);
double y0 = (barrelRect.Right() + 5) * Math.Sin(radians);
double x = x0 + velx * time;
double y = y0 + vely * time - 0.5 * gravity * time * time;
QRect result = new QRect(0, 0, 6, 6);
result.MoveCenter(new QPoint((int) Math.Round(x), Height() - 1 - (int) Math.Round(y)));
return result;
}