示例#1
0
        public void DisegnaMesi()
        {
            // Create a GraphicsPath object.
            GraphicsPath myPath = new GraphicsPath();
            // Set up all the string parameters.
            TrAngoliDate AngRadMesi = new TrAngoliDate();
            StringFormat format     = StringFormat.GenericDefault;
            float        BetaG      = 0F;

            for (int i = 0; i < 12; i++)
            {
                float      AlfaR    = AngRadMesi.AngoloMeseRadianti(i, 2005);
                float      AlfaG    = AngRadMesi.AngoloMeseGradi(i, 2005);
                float      baseR    = Convert.ToSingle(3.0 / 4.0 * raggio * Math.Cos(AlfaR / 2.0));
                float      AltezzaR = Convert.ToSingle(1.0 / 2.0 * raggio * Math.Sin(AlfaR / 2.0));
                SizeF      SizeR    = new SizeF(baseR, AltezzaR);
                RectangleF LblRect  = new RectangleF(NCenter, SizeR);
                //myPath.AddRectangle(LblRect);
                string     stringText = AngRadMesi.strMese(i);
                FontFamily family     = new FontFamily("Arial");
                int        fontStyle  = (int)FontStyle.Italic;
                int        emSize     = Convert.ToInt32(AltezzaR) + 1;


                // Add the string to the path.
                myPath.AddString(stringText, family, fontStyle, emSize, Center, format);
                // Trasformazione Di  Traslazione sull'etichetta
                Matrix T = new Matrix();
                T.Translate(raggio / 4, -AltezzaR);
                // Trasformazione Di  Rotazione Sull'etichetta
                Matrix R = new Matrix();
                R.RotateAt(-AlfaG / 2.0F, new PointF(Center.X + raggio / 4, Center.Y));
                T.Multiply(R, MatrixOrder.Append);
                myPath.Transform(T);
                Matrix RGlobale = new Matrix();
                RGlobale.RotateAt(-BetaG, Center);
                myPath.Transform(RGlobale);
                g.FillPath(Brushes.BlueViolet, myPath);
                T.Reset();
                R.Reset();
                RGlobale.Reset();
                myPath.Reset();
                BetaG = AlfaG + BetaG;
            }
        }