• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
wjshan0808

Learn from yesterday, Live for today, For a better tomorrow.
 ————wjshan0808

博客园    首页    新随笔    联系   管理    订阅  订阅

向区域中追加文本

 Graphics g;//画板
        GraphicsPath path;//路径 
        private void button1_Click(object sender, EventArgs e)
        {
            //从路径中构造区域
            Region region = new Region(path);
            //填充区域    
            g.FillRegion(Brushes.Green, region);
        }
        private void Form2_Paint(object sender, PaintEventArgs e)
        {
            g = this.CreateGraphics();//画板对象
            g.Clear(Color.White);//画板背景色
            //设定文本输出质量
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            g.SmoothingMode = SmoothingMode.AntiAlias;
            //创建路径区域
            path = new GraphicsPath( FillMode.Alternate);

            //向区域中追加文本
            path.AddString("wjshan0808", new FontFamily("微软雅黑"), (int)FontStyle.Regular, 60.0f, new Point(0, 0), new StringFormat());

            //绘制路径
            g.DrawPath(new Pen(Color.Red), path);
            g.TranslateTransform(0, 80);
        }

 


posted @ 2015-01-21 17:36  wjshan0808  阅读(165)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3