改变有图片背景的Form大小时,Form发生闪烁,请教如何消除闪烁现象?
步骤:
1.创建新工程
2.添加Image控件,属性 Stretch=True
picture = app.path & "\sy4.bmp"
3.编写代码。为使图片随窗口的大小改变而改变,编写如下代码:
Private Sub Form_Load()
Image1.Width = Me.Width / Screen.TwipsPerPixelY
Image1.Height = Me.Height / Screen.TwipsPerPixelX
End Sub Private Sub Form_Resize()
Image1.Width = Me.Width / Screen.TwipsPerPixelY
Image1.Height = Me.Height / Screen.TwipsPerPixelX
End Sub
4. 运行。
当改变窗口的大小时,窗口发生闪烁现象
步骤:
1.创建新工程
2.添加Image控件,属性 Stretch=True
picture = app.path & "\sy4.bmp"
3.编写代码。为使图片随窗口的大小改变而改变,编写如下代码:
Private Sub Form_Load()
Image1.Width = Me.Width / Screen.TwipsPerPixelY
Image1.Height = Me.Height / Screen.TwipsPerPixelX
End Sub Private Sub Form_Resize()
Image1.Width = Me.Width / Screen.TwipsPerPixelY
Image1.Height = Me.Height / Screen.TwipsPerPixelX
End Sub
4. 运行。
当改变窗口的大小时,窗口发生闪烁现象
Private Sub Form_Load()
Me.ScaleMode = 3
Me.AutoRedraw = True
Picture1.ScaleMode = 3
Picture1.Picture = LoadPicture("c:/test.bmp")
End SubPrivate Sub Form_Resize()
Me.PaintPicture Picture1.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
End Sub
2.用lockwindowupdate form1.hwnd试试
1.朋友 yimain(残雪) 提供的代码已测试,未成功(图像显示大于窗口)。
2.关于DirectX,不知jackcaixia(风) 朋友能否提供些资料?
DirectX语句其实是写游戏的~~