GFSkinEngine/AutoRedrawTestfrm.frm

VERSION 5.00
Begin VB.Form AutoRedrawTestfrm
   Caption         =   "AutoRedrawTest"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6975
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   6975
   StartUpPosition =   3 'Windows‑Standard
   Begin VB.PictureBox Picture3
      Height          =   1815
      Left            =   4140
      ScaleHeight     =   1755
      ScaleWidth      =   1815
      TabIndex        =   3
      Top             =   60
      Width           =   1875
   End
   Begin VB.PictureBox Picture1
      Height          =   1815
      Left            =   60
      ScaleHeight     =   1755
      ScaleWidth      =   1815
      TabIndex        =   2
      Top             =   60
      Width           =   1875
   End
   Begin VB.PictureBox Picture2
      Height          =   1815
      Left            =   2100
      ScaleHeight     =   1755
      ScaleWidth      =   1815
      TabIndex        =   1
      Top             =   60
      Width           =   1875
   End
   Begin VB.CommandButton Command1
      Caption         =   "Test"
      Height          =   375
      Left            =   5340
      TabIndex        =   0
      Top             =   2760
      Width           =   1575
   End
End
Attribute VB_Name = "AutoRedrawTestfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'(c)2001 by Louis (reviewed 2002). Test to debug the GFSkinEngine graphics system (damn it!).
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As LongByVal X As LongByVal Y As LongByVal nWidth As LongByVal nHeight As LongByVal hSrcDC As LongByVal xSrc As LongByVal ySrc As LongByVal dwRop As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long

Private Sub Command1_Click()
    'on error resume next
    Dim DCStructVar As DCStruct

'    Picture1.ScaleMode = vbPixels
'    Picture2.ScaleMode = vbPixels
'    Picture3.ScaleMode = vbPixels
'
'    Picture1.AutoRedraw = True
'    Picture2.AutoRedraw = True
'    Picture3.AutoRedraw = True
'
    Call SE_FileToPictureBox("C:\SYSTEM\Ägypten.bmp", Picture1)
'
'    Call SE_PictureBoxToDCStruct(Picture1, DCStructVar)
'
'    Call SelectObject(Picture1.hdc, DCStructVar.DC)
'    Picture1.Visible = False

    'Do
        'Call SE_PictureBoxToDCStruct(Picture1, DCStructVar)
        'Call GFSM_DeleteDC(DCStructVar.DC)
        'Call GFSM_DeleteDC(DCStructVar.DC)
        'Exit Do
    'Loop
    'Call SE_PictureBoxToPictureBox(Picture1, Picture2)

    Call SE_PictureBoxToDCStruct(Picture1, DCStructVar)
    Call SE_DCStructToPictureBox(DCStructVar, Picture3)
    Call GFSM_DeleteObject(DCStructVar.DC)
    Call GFSM_DeleteDC(DCStructVar.DC)

    'Call GFSM_Terminate

End Sub

'NOTE: this is what was found out within 4 hours trying around:
'((1): AutoRedraw enabled, (2): AutoRedraw disabled)
'
'Printing:
'(1) possible, stays when picture was box hidden
'(2) possible, disappears when picture box was hidden
'Printing, .Picture property preset at design‑time:
'(1) circle stays, picture stays
'(2) circle disappears, picture disappears
'Printing, .Picture property set at runtime
'(1) circle stays, picture stays
'(2) circle disappears, picture disappears
'
'NOTE: for (2) the picture stays until 'Stop' is used or the window
'lost and get the focus (moving the window out of the visible desktop area
'does not 'destroy' the picture).
'
'SE_FileToPictureBox()
'(1) circle stays, picture stays
'(2) circle disappears, picture disappears
'
'=> AutoRedraw must be True to retain any picture box when the window
'was hidden and re‑shown.
'
'SE_PictureBoxToDCStruct() + SE_DCStructVarToPictureBox()
'(1) conversion works
'(2) conversion works
'BitBlt from Picture1 to Picture2
'(A) (1) + (1): result visible not before target picture box was redrawn
'(re‑shown or .Refresh used)
'(B) (1) + (2): works instantly, but result is not retained (.Refresh deletes result)
'(C) (2) + (1): like (A) (retained, but .Refresh necessary)
'(D) (2) + (2): like (B) (not retained, but visible instantly)
'BitBlt from Picture1 to Picture2 to Picture3
'(A) (2) + (2R) + (2R): works fine (R: use .Refresh)
'
'For the final result read the top annotation in GFSkinEnginemod.


[END OF FILE]