Form1.frm

 VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   3972
   ClientLeft      =   120
   ClientTop       =   408
   ClientWidth     =   3912
   LinkTopic       =   "Form1"
   ScaleHeight     =   331
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   326
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox PBox
      BackColor       =   &H0000FFFF&
      Height          =   1920
      Index           =   3
      Left            =   1995
      ScaleHeight     =   156
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   156
      TabIndex        =   3
      Top             =   2055
      Width           =   1920
   End
   Begin VB.PictureBox PBox
      BackColor       =   &H00FF0000&
      Height          =   1920
      Index           =   2
      Left            =   0
      ScaleHeight     =   156
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   156
      TabIndex        =   2
      Top             =   2055
      Width           =   1920
   End
   Begin VB.PictureBox PBox
      BackColor       =   &H0000C000&
      Height          =   1920
      Index           =   1
      Left            =   1995
      ScaleHeight     =   156
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   156
      TabIndex        =   1
      Top             =   75
      Width           =   1920
   End
   Begin VB.PictureBox PBox
      BackColor       =   &H000000FF&
      Height          =   1920
      Index           =   0
      Left            =   0
      ScaleHeight     =   156
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   156
      TabIndex        =   0
      Top             =   75
      Width           =   1920
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'
'StretchBmp Demo form
'
'Most of this code is me just having fun with making the images fill the form!
'

Private Sub Form_Load()
    Dim iSW As Integer
    Dim iSH As Integer

    'Prepare the four PictureBoxes for Stretching
        StretchPrep Me, PBox(0), "sol.bmp"
        StretchPrep Me, PBox(1), "write.bmp"
        StretchPrep Me, PBox(2), "write.bmp"
        StretchPrep Me, PBox(3), "sol.bmp"
   
    'Align the PictureBoxes:
            iSW = ScaleWidth / 2
            iSH = ScaleHeight / 2
       
            ScaleMode = 3  'Pixels (if you don
           
            With PBox(0)
                .AutoRedraw = True
                .Move 0, 0, iSW, iSH
            End With
            With PBox(1)
                .AutoRedraw = True
                .Move iSW, 0, iSW, iSH
            End With
            With PBox(2)
                .AutoRedraw = True
                .Move 0, iSH, iSW, iSH
            End With
            With PBox(3)
                .AutoRedraw = True
                .Move iSW, iSH, iSW, iSH
            End With
       
   
End Sub


Private Sub Form_Resize()
'on form resize I'm resizing the PictureBoxes, which in turn triggers the PBox_Resize routine
    Dim iSW As Integer
    Dim iSH As Integer
   
    iSW = ScaleWidth / 2
    iSH = ScaleHeight / 2

    PBox(0).Move 0, 0, iSW, iSH
    PBox(1).Move iSW, 0, iSW, iSH
    PBox(2).Move 0, iSH, iSW, iSH
    PBox(3).Move iSW, iSH, iSW, iSH
   
End Sub

Private Sub PBox_Resize(Index As Integer)
'Since I made all of my PictureBoxes copies of the original, they belong to a control array
'so I only need this one statement to change each one!
    StretchPB PBox(Index)
End Sub

Project Homepage: