现在遇到一个问题,就是在wpf中用InkCanvas画图,我如何设置画笔在InkCanvas中画的时候每一笔下去是正方形,现在她默认是圆形。现在就是随便在InkCanvas上点一下,都是一个圆形,如何把他修改成正方形。
求高手解决。System.Windows.Ink.DrawingAttributes s = PicCanvas_right.DefaultDrawingAttributes;
          s.Width = int.Parse(Model.SelectBrush);
          s.Height = int.Parse(Model.SelectBrush);           
          s.Color = (Color)ColorConverter.ConvertFromString(Model.SelectColor);

解决方案 »

  1.   

    // Set up the DrawingAttributes for the pen.
    inkDA = new DrawingAttributes();
    inkDA.Color = Colors.SpringGreen;
    inkDA.Height = 5;
    inkDA.Width = 5;
    inkDA.FitToCurve = false;
    inkDA.StylusTipTransform = new Matrix(1, 0, 0, 5, 0, 0);http://msdn.microsoft.com/en-us/library/system.windows.ink.drawingattributes.stylustip.aspx
     
    // Set up the DrawingAttributes for the highlighter.
    highlighterDA = new DrawingAttributes();
    highlighterDA.Color = Colors.Orchid;
    highlighterDA.IsHighlighter = true;
    highlighterDA.IgnorePressure = true;
    highlighterDA.StylusTip = StylusTip.Rectangle;
    highlighterDA.Height = 30;
    highlighterDA.Width = 10;inkCanvas1.DefaultDrawingAttributes = inkDA;
      

  2.   

    highlighterDA.StylusTip = StylusTip.Rectangle;就是这句话。谢谢你。