| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 568 人关注过本帖
标题:请教一个绘图的问题
取消只看楼主 加入收藏
zh286091487
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2007-3-22
收藏
 问题点数:0 回复次数:1 
请教一个绘图的问题
当我打开菜单的时候,被菜单掩盖的图形就会消失,为什么啊?
搜索更多相关主题的帖子: 图形 绘图 菜单 掩盖 
2007-04-11 20:38
zh286091487
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2007-3-22
收藏
得分:0 

不是的
我的代码如下
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Drawing
Public Class Form1
Dim g As Graphics
Dim p As New Pen(Color.Blue, 5)
Dim x, y As Integer
Dim bmp As Bitmap


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'g = Me.PictureBox1.CreateGraphics
bmp = New Bitmap(Me.PictureBox1.ClientSize.Width, Me.PictureBox1.ClientSize.Height)
PictureBox1.BackgroundImage = bmp
g = Graphics.FromImage(bmp)

End Sub

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
x = e.X
y = e.Y
End Sub

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
g = Me.PictureBox1.CreateGraphics
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
If e.Button = Windows.Forms.MouseButtons.Left Then
g.DrawLine(p, x, y, e.X, e.Y)
x = e.X
y = e.Y

End If
End Sub

Private Sub 保存SToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 保存SToolStripMenuItem.Click

With Me.SaveFileDialog1
.Title = "保存"
.Filter = "jpg(*.jpg)|*.jpg|所有文件(*.*)|*.*"
End With
If Me.SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK And _
Me.SaveFileDialog1.FileName.Length > 0 Then


bmp.Save(Me.SaveFileDialog1.FileName)
End If

End Sub
End Class

请帮我看看

2007-04-14 12:16
快速回复:请教一个绘图的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020991 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved