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 3:40am
Edited 18-Sep-12 4:17am
(no name)94.3K
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 DamithSL 265
1 CPallini 235
2 OriginalGriff 233
3 Maciej Los 195
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web04 | 2.8.141216.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