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

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

vb.net Bitmap Drawing


 

Public Class Form1
	Dim BMP As New Drawing.Bitmap(640, 480)
	Dim GFX As Graphics = Graphics.FromImage(BMP)
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		FX.FillRectangle(Brushes.White, 0, 0, PictureBox1.Width, PictureBox1.Height)
		GFX.DrawLine(Pens.Red, 10, 10, 50, 50)
		GFX.DrawString("Robomatics", SystemFonts.DefaultFont, Brushes.Black, 60, 60)
		PictureBox1.Image = BMP
	End Sub
	Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
		BMP.SetPixel(MousePosition.X - Me.Location.X - PictureBox1.Location.X - 4, MousePosition.Y - Me.Location.Y - PictureBox1.Location.Y - 30, Color.Black)
		GFX.DrawString("Robomatics", SystemFonts.DefaultFont, Brushes.Black, MousePosition.X - Me.Location.X - PictureBox1.Location.X - 4, MousePosition.Y - 	Me.Location.Y - PictureBox1.Location.Y - 30)
		PictureBox1.Image = BMP
	End Sub
End Class


 

 

posted @ 2013-08-14 19:19  Class Xman  阅读(642)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3