zoukankan      html  css  js  c++  java
  • VB6保存表单图像到文件

    下载FormImageSave - 2.14 KB IntroductionThis是示例代码将VB 6.0的图像形式保存到一个文件中。 BackgroundNormally表单。图像属性只提供图纸和印刷 位图图像的文本。但是如果有图像控制,按钮, 图标等形式,那么这个代码的照片。 使用codeThere是一个过程SaveFormImageToFile自我explainatory。使用API BitBlt形成图像转换为图片,并将其分配给图片框。然后图片框的图像属性用于存储图片使用SavePicture方法。 添加一个单独的图片框、命令按钮的形式属性如下考虑: 隐藏,收缩,复制Code

    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
    
    Public Sub SaveFormImageToFile(ByRef ContainerForm As Form, _
                                   ByRef PictureBoxControl As PictureBox, _
                                   ByVal ImageFileName As String)
      Dim FormInsideWidth As Long
      Dim FormInsideHeight As Long
      Dim PictureBoxLeft As Long
      Dim PictureBoxTop As Long
      Dim PictureBoxWidth As Long
      Dim PictureBoxHeight As Long
      Dim FormAutoRedrawValue As Boolean
      
      With PictureBoxControl
        'Set PictureBox properties
        .Visible = False
        .AutoRedraw = True
        .Appearance = 0 ' Flat
        .AutoSize = False
        .BorderStyle = 0 'No border
        
        'Store PictureBox Original Size and location Values
        PictureBoxHeight = .Height: PictureBoxWidth = .Width
        PictureBoxLeft = .Left: PictureBoxTop = .Top
        
        'Make PictureBox to size to inside of form.
        .Align = vbAlignTop: .Align = vbAlignLeft
        DoEvents
        
        FormInsideHeight = .Height: FormInsideWidth = .Width
        
        'Restore PictureBox Original Size and location Values
        .Align = vbAlignNone
        .Height = FormInsideHeight: .Width = FormInsideWidth
        .Left = PictureBoxLeft: .Top = PictureBoxTop
        
        FormAutoRedrawValue = ContainerForm.AutoRedraw
        ContainerForm.AutoRedraw = False
        DoEvents
        
        'Copy Form Image to Picture Box
        BitBlt .hDC, 0, 0, _
        FormInsideWidth / Screen.TwipsPerPixelX, _
        FormInsideHeight / Screen.TwipsPerPixelY, _
        ContainerForm.hDC, 0, 0, _
        vbSrcCopy
        
        DoEvents
        SavePicture .Image, ImageFileName
        DoEvents
        
        ContainerForm.AutoRedraw = FormAutoRedrawValue
        DoEvents
      End With
    End Sub
    
    Private Sub Command1_Click()
      SaveFormImageToFile frmSaveFormImageToFile, Picture1, "C:Temp.bmp"
    End Sub

    否则,代码将它。图像的兴趣点的形式在VB 6以及控制和图像是新的。历史上这段代码是我第一次上传 本文转载于:http://www.diyabc.com/frontweb/news2457.html

  • 相关阅读:
    CMDB
    Linux文档编辑
    Linux文件管理
    Scrapy框架全
    爬虫基础
    C#中的泛型-1
    网络协议
    PDF抽取文字 C# with Adobe API
    PDF转图片 C# with Adobe API
    浅谈Exchange 2013开发-如何操作邮件的附件
  • 原文地址:https://www.cnblogs.com/Dincat/p/13457787.html
Copyright © 2011-2022 走看看