PathGradientBrush::GetTransform 方法获取此路径渐变画笔的转换矩阵。
语法
Status GetTransform(
  [out] Matrix *matrix
);
parameters
[out] matrix
类型: 矩阵*
指向接收转换 矩阵的 Matrix 对象的指针。
返回值
类型: 状态
如果该方法成功,则返回 Ok,这是 Status 枚举的元素。
如果方法失败,它将返回 Status 枚举的其他元素之一。
注解
PathGradientBrush 对象维护可存储任何仿射转换的转换矩阵。 使用路径渐变画笔填充区域时,GDI+ 根据画笔的转换矩阵转换画笔的边界路径,然后填充转换后的路径的内部。 转换后的路径仅在呈现期间存在;未转换 存储在 PathGradientBrush 对象中的边界路径。
示例
以下示例基于三个点的数组创建 PathGradientBrush 对象。 PathGradientBrush::ScaleTransform 和 PathGradientBrush::TranslateTransform 方法设置画笔转换矩阵的元素,以便矩阵表示复合转换 (第一个刻度,然后平移) 。 该复合转换适用于画笔的边界路径,因此调用 FillRectangle 会填充三角形的内部,该三角形是缩放和平移边界路径的结果。 该代码调用 PathGradientBrush 对象的 PathGradientBrush::GetTransform 方法以获取画笔的转换矩阵,然后调用检索到的 Matrix 对象的 GetElements 方法,以使用矩阵元素填充数组。
VOID Example_GetTransform(HDC hdc)
{
  Graphics graphics(hdc);
   // Create a path gradient brush and set its transformation.
   Point pts[] = {Point(0, 0), Point(50, 0), Point(50, 50)};
   PathGradientBrush pthGrBrush(pts, 3);
   pthGrBrush.ScaleTransform(3.0f, 1.0f);
   pthGrBrush.TranslateTransform(10.0f, 30.0f, MatrixOrderAppend);
   graphics.FillRectangle(&pthGrBrush, 0, 0, 200, 200);
   // Obtain information about the path gradient brush.
   Matrix matrix;
   REAL elements[6];
   pthGrBrush.GetTransform(&matrix);
   matrix.GetElements(elements);
   for(INT j = 0; j <= 5; ++j)
   {
      // Inspect or use the value in elements[j].
   } 
}
要求
| 最低受支持的客户端 | Windows XP、Windows 2000 Professional [仅限桌面应用] | 
| 最低受支持的服务器 | Windows 2000 Server [仅限桌面应用] | 
| 目标平台 | Windows | 
| 标头 | gdipluspath.h (包括 Gdiplus.h) | 
| Library | Gdiplus.lib | 
| DLL | Gdiplus.dll |