标题:请教一个绘图的问题
只看楼主
zh286091487
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2007-3-22
 问题点数:0 回复次数:2 
请教一个绘图的问题
当我打开菜单的时候,被菜单掩盖的图形就会消失,为什么啊?
搜索更多相关主题的帖子: 图形 绘图 菜单 掩盖 
2007-04-11 20:38
Kendy123456
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:62
帖 子:2720
专家分:0
注 册:2007-1-3
得分:0 
是不是被其它控件挡住了? 用bringtofront 方法放到前面来

2007-04-12 09:18
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-131111-1-1.html




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

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