大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
你光create位图,不释放,肯定崩溃呀。的释放,DeleteObject释放Bitmap,DeleteDC释放DC,另外Graphics.FromHwnd(Form1.DIVPanel.Handle)返回的DC也需要释放,代码改成这样:
10年积累的网站设计制作、网站设计经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站制作后付款的网站建设流程,更有登封免费网站建设让你可以放心的选择与我们合作。
Function GetSerPic(Optional ByVal BitWidth As Integer = -1, Optional ByVal BitHeight As Integer = -1) As Image
Dim g As Graphics = Graphics.FromHwnd(Me.DIVPanel.Handle)
Dim SourceDC As Long = g.GetHdc()
Dim Bhandle, DestDC As Long, Old As Long
DestDC = CreateCompatibleDC(SourceDC)
Bhandle = CreateCompatibleBitmap(SourceDC, BitWidth, BitHeight)
Old = SelectObject(DestDC, Bhandle)
BitBlt(DestDC, 0, 0, BitWidth, BitHeight, SourceDC, 0, 0, HCC0020)
Dim bmp As Bitmap = Image.FromHbitmap(Bhandle)
SelectObject(DestDC, Old)
DeleteObject(Bhandle)
DeleteDC(DestDC)
g.ReleaseHdc()
Return bmp
End Function
shell "路径" ;先调用
然后
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Form_Load()
Me.Hide
Me.AutoRedraw = True
BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, GetDC(0), 0, 0, vbSrcCopy
sFile$ = "C:\" Format(Now, "mmddhhmmss") ".BMP"
SavePicture Me.Image, sFile
MsgBox "当前屏幕图像已经保存到" sFile, 64
End
End Sub ;保存截图
当然是全部重画。
层只不过是制图软件弄出来的一个方便的东西而已。
就像你画画,画上去如果你要擦掉当然是擦到底色咯。(当然GDI+也可以像你画画一样只擦一部分)
GDI+时钟我写过一个VB6的。代码详见我博客。地址显然百度不让贴上= =。所以你可以看下我的资料。
你可以模拟层,就是把所有绘制信息都保存起来。你的流程应当是:
如果要绘制了,更新绘制信息(可以是数组啥的。),交给一个Draw过程
Draw过程:根据绘制信息,全部绘制。
By vIstaswx ,before junior school graduation exam.
GDI绘图用字体必须安装才能使用
在客户机部署应用程序时,安装该字体就行