vb2005 为什么graphic图形在当前窗口会消失

song710210 2014-02-03 11:50:01
我用vb2005编了一个小程序,其中用到Graphics.FillEllipse 方法,但在运行过程中用Graphics.FillEllipse 方法产生的图形在当前窗口会消失,即没有更换窗口,谁能告诉我
为什么,谢谢。
...全文
207 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
苦苦的潜行者 2014-02-14
  • 打赏
  • 举报
回复
引用 2 楼 caozhy 的回复:
要写在Paint事件中。否则只要窗体被重绘,上面已绘制的东西都会消失。
版主帮我看看,这段代码吧,也是画图的问题. http://bbs.csdn.net/topics/390708385
dylike 2014-02-03
  • 打赏
  • 举报
回复
dim B as new bitmap(me.width,me.height) using g as graphics=graphics.fromimage(b) 画画 end using me.backgroundimage=B
wind_cloud2011 2014-02-03
  • 打赏
  • 举报
回复

试试这个代码:
  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
        Dim redBrush As New SolidBrush(Color.Red)
        Dim x As Single = 0.0F
        Dim y As Single = 0.0F
        Dim width As Single = 200.0F
        Dim height As Single = 100.0F
        e.Graphics.FillEllipse(redBrush, x, y, width, height)
    End Sub

threenewbee 2014-02-03
  • 打赏
  • 举报
回复
要写在Paint事件中。否则只要窗体被重绘,上面已绘制的东西都会消失。
wind_cloud2011 2014-02-03
  • 打赏
  • 举报
回复
看看代码

16,721

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧