Example #1
0
        private void DrawRegiment(DrawingContext dc, int x, int y, int angle, Battalion bn)
        {
            int width     = bn.GetWidthInPaces();
            int halfwidth = width / 2;
            int height    = bn.GetDepthInPaces();

            dc.PushTransform(new RotateTransform(angle, x + halfwidth, y));

            // Create a rectangle and draw it in the DrawingContext.
            Rect rect = new Rect(new System.Windows.Point(x, y), new System.Windows.Size(width, height));

            dc.DrawRectangle(System.Windows.Media.Brushes.Blue, (System.Windows.Media.Pen)null, rect);

            //Rect rect2 = new Rect(new System.Windows.Point(x, y + height), new System.Windows.Size(width, 10));
            //dc.DrawRectangle(System.Windows.Media.Brushes.Black, (System.Windows.Media.Pen)null, rect2);

            /*
             * Rect rect3 = new Rect(new System.Windows.Point(x + (halfwidth - widgetsize) //150
             * , y - widgetsize), new System.Windows.Size(20, 10));
             * dc.DrawRectangle(System.Windows.Media.Brushes.Red, (System.Windows.Media.Pen)null, rect3);
             */

            dc.DrawText(


                new FormattedText(bn.ShortName,
                                  CultureInfo.GetCultureInfo("en-us"),
                                  FlowDirection.LeftToRight,
                                  new Typeface("Verdana"),
                                  12, System.Windows.Media.Brushes.Black),
                new System.Windows.Point(x, y + height));



            dc.Pop();
        }