Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Munirah Malik

@Munirah Malik
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Why the picture not save correctly if I change from button click to form load
    M Munirah Malik

    Hi admin, I tried changed this code. I change the system save picture on form load not on button click. but the result, picture not save correctly. only blank picture. can we save the picture on form load? I use vb6

    Private Sub Form_Load()
    Call Command1_Click
    End Sub

    Private Sub Command1_Click()
    SaveFormImageToFile frmSaveFormImageToFile, Picture1, "C:\Temp.bmp"
    End Sub

    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

    Visual Basic question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups