本文整理匯總了C#中System.Windows.Shapes.Rectangle.SetBounds方法的典型用法代碼示例。如果您正苦於以下問題:C# Rectangle.SetBounds方法的具體用法?C# Rectangle.SetBounds怎麽用?C# Rectangle.SetBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Shapes.Rectangle
的用法示例。
在下文中一共展示了Rectangle.SetBounds方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ApplyMatrix
private static string ApplyMatrix(Rectangle RB, Rectangle GB, Rectangle R, Rectangle G, Rectangle B, Image g, double gx, double gy, double gw, double gh)
{
var p = new
{
R = new { x = Canvas.GetLeft(R), y = Canvas.GetTop(R) },
G = new { x = Canvas.GetLeft(G), y = Canvas.GetTop(G) },
B = new { x = Canvas.GetLeft(B), y = Canvas.GetTop(B) }
};
var q = new
{
R = new { x = p.R.x - p.B.x, y = p.R.y - p.B.y },
G = new { x = p.G.x - p.B.x, y = p.G.y - p.B.y },
B = new { x = p.B.x - gx, y = p.B.y - gy },
};
RB.SetBounds(p.R.x, p.R.y, p.B.x, p.B.y);
GB.SetBounds(p.G.x, p.G.y, p.B.x, p.B.y);
var m = new
{
M11 = q.R.x / gw,
M12 = q.R.y / gh,
M21 = q.G.x / gw,
M22 = q.G.y / gh,
OX = q.B.x,
OY = q.B.y
};
var s = q.ToString() + Environment.NewLine + m.ToString();
g.RenderTransform = new MatrixTransform(m.M11, m.M12, m.M21, m.M22, m.OX, m.OY);
return s;
}