C#winform 画图

文本的旋转显示

       private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g =e.Graphics;
            g.SmoothingMode=SmoothingMode.AntiAlias;
            //声明并初始化Graphics对象g
            string tempstr = "Hello C#";
            //取得要显示的文字
            for(int i=0;i<361;i=i+10)
            {
                g.TranslateTransform(150, 150);
                g.RotateTransform(i);
                //将指定的旋转用于g的变换矩阵
                //将指定的平移添加到g的变换矩阵前
                Brush myBrush=Brushes.Blue;
                g.DrawString(tempstr, this.Font, myBrush, 60, 0);
                //显示旋转文字
                g.ResetTransform();
                //将g的全局变换矩阵重置为单位矩阵
            }
        }

 

阴影效果的文字

           Graphics g=e.Graphics; 
            Font myFont;
            myFont=new Font("SansSerif",40); 
            
            SolidBrush textShadowBrush = new SolidBrush(Color.FromArgb(70, Color.Blue));

            g.DrawString("Hello C#",myFont,Brushes.Blue, 25, 25 );
            g.DrawString("Hello C#",myFont,textShadowBrush, 30, 30);

阴影效果的文字

           Graphics g=e.Graphics; 
            Font myFont;
            myFont=new Font("SansSerif",40); 
            
            SolidBrush textShadowBrush = new SolidBrush(Color.FromArgb(70, Color.Blue));

            g.DrawString("Hello C#",myFont,Brushes.Blue, 25, 25 );
            g.DrawString("Hello C#",myFont,textShadowBrush, 30, 30);

原文地址:https://www.cnblogs.com/zhangdongdong/p/2825640.html