LoadPic |
Description
Loads a graphic into certain properties of a form or control. |
Syntax
[Set oPic =] oDlg. LoadPic ( sPicture ) |
Parameters
Part |
Description |
Set oPic = |
An object variable or picture property you want to assign the graphic to. The properties include the Picture, DownPicture and DisabledPicture properties of a CommandButton control, the MouseIcon property of the Image control and the Icon property of a form. |
oDlg |
A reference to the WshDialog.Kit automation object (as returned by the Wscript or VBScript CreateObject methods) |
sPicture |
String expression specifying a filename. Can include folder and drive. Graphics formats recognized include bitmap (.bmp) files, icon (.ico) files, cursor (.cur) files, run-length encoded (.rle) files, metafile (.wmf) files, enhanced metafiles (.emf), GIF (.gif) files, and JPEG (.jpg) files |
Example
Option Explicit Set oDlg = Wscript.CreateObject("WshDialog.Kit", "oDlg_") 'Add a new form and store a reference to it in the variable oFrm Set oFrm = oDlg.NewForm("Sample") 'Add a button named BTN1 to the oFrm form and store a reference in the variable oCtl Set oCtl = oFrm.NewButton("BTN1", 150, 50, 1000, 1000, "&Button") 'Use the reference variable to set the Picture and DownPicture properties oCtl.Picture = oDlg.LoadPic("C:\Windows\HlpGlobe.gif") oCtl.DownPicture = oDlg.LoadPic("C:\Windows\HlpBell.gif") 'Automatically size the form to the controls placed on it oFrm.AutoSize 'Show the form oFrm.Show vbModal |