Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF
I am facing problem to draw a calligraphy geometryin WPF, using DrawingContext.DrawGeometry(null,Mypen, pathGeometry);Even I am assigning ScaleTransform to brush of Pen. but that is not working,If you have any solution please reply soon......
 
public override void Draw(DrawingContext drawingContext)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            Color oColor = Color.FromArgb((byte)(Opecity * 2.55), ObjectColor.R, ObjectColor.G, ObjectColor.B);
            Pen Mypen = new Pen(new SolidColorBrush(oColor), ActualLineWidth);
            Mypen.StartLineCap = PenLineCap.Round;
            Mypen.EndLineCap = PenLineCap.Round;
 
           
           drawingContext.PushTransform(new ScaleTransform(1, 5,this.Rectangle.Left+this.Rectangle.Width/2,this.Rectangle.Top+this.Rectangle.Height/2));
           drawingContext.PushTransform(new RotateTransform(30));
 
           pathGeometry=GetPathGeometryFromPoints(); //private method in same class 

           drawingContext.DrawGeometry(null, Mypen, pathGeometry);
     drawingContext.Pop();
 
            base.Draw(drawingContext);
        }
Posted 18-Sep-12 2:40am
Edited 18-Sep-12 3:17am
85K
v2
Comments
Wes Aday at 18-Sep-12 9:19am
   
What exactly does "that is not working" mean? Does it not draw? Does your drawing routine never get called? The code is called but your car exploded?
deepak2121 at 25-Sep-12 1:47am
   
The above code is working fine for draw a geometry. but my requirement is how to draw a calligraphy geometry in wpf

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 604
1 thatraja 370
2 OriginalGriff 319
3 Sergey Alexandrovich Kryukov 241
4 kbrandwijk 204
0 OriginalGriff 737
1 Dnyaneshwar@Pune 604
2 Kornfeld Eliyahu Peter 505
3 Sergey Alexandrovich Kryukov 395
4 thatraja 370


Advertise | Privacy | Mobile
Web03 | 2.8.140902.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100