日期:2014-05-18  浏览次数:21342 次

GDI/GDI+如何实现文字描边效果
Graphics g = e.Graphics;
  g.Clear(Color.Blue);
  GraphicsPath myPath = new GraphicsPath();

  // Set up all the string parameters.
  string stringText = "测试文字觉得对方";
  FontFamily family = new FontFamily("宋体");
  int fontStyle = (int)FontStyle.Bold;
  int emSize = 20;
  Point origin = new Point(20, 20);
  StringFormat format = StringFormat.GenericDefault;

  // Add the string to the path.
  myPath.AddString(stringText,
  family,
  0,
  emSize,
  origin,
  format);

  //Draw the path to the screen.
  e.Graphics.FillPath(Brushes.Black, myPath);
  e.Graphics.DrawPath(new Pen(Color.White), myPath);

这种方法效果很差,需要实现像Winamp V5.54版本的漂浮歌词文字效果(这里图片上传有错误),描边无锯齿。

------解决方案--------------------
没搞过.

关注一下~`
------解决方案--------------------
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;

加上红色的的那一句就可以了
------解决方案--------------------
以前作GDI没碰到过这个功能要求,还真不知道有这样的功能,不过测试了一下代码,确实好功能,很好很强大。
------解决方案--------------------
探讨
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;

加上红色的的那一句就可以了

------解决方案--------------------
探讨
引用:
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;

加上红色的的那一句就可以了


支持!