Delphi GDI+ DrawString Transparent From Left and Right

落爺英雄遲暮 提交于 2020-01-05 03:31:54

问题


I have problem drawing text transparent from left and right like this example: Image1:

What i have done so far:

var
  linGrBrush: TGPLinearGradientBrush;
  Text : String;
  x, y : Single;
Begin
  Graphics.Clear(0);
  linGrBrush := TGPLinearGradientBrush.Create(MakePoint(0, 0),
                  MakePoint(300, 0), MakeColor(0, 0, 0, 0), MakeColor(255, 255, 0, 0));
      linGrBrush.SetBlendTriangularShape(0.8);
      Text := 'Transparent Text From Left And Right';
      x:= 0;
      y:= 0;
      Graphics.DrawString(Text, Length(Text), Font, MakePoint(x, Y), linGrBrush);

Result: Image2:

How can i fix this?

来源:https://stackoverflow.com/questions/28124914/delphi-gdi-drawstring-transparent-from-left-and-right

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!