Tech Note 13: PictureBox Control

April 08, 2009

© NS BASIC Corporation. All rights reserved.

Overview

The NS Basic PictureBox control (NSCEPictureBox.ocx) is available for NS Basic/Desktop and NS Basic/CE version 6 or later. It replaces the Microsoft PictureBox control (MSCEPicture.dll) and the S309 PictureBox (S309PictureBox.ocx). All functions in the older controls should work the same way in this control.

NS Basic/CE

AddObject "PictureBox" uses this control. As a result, older programs will automatically start using the control. However, if you used the long form of the name, "PictureBox.PictureBox", it will always use the Microsoft PictureBox control (MSCEPicture.dll). If you want to be sure you get this control, use AddObject "NSCEPictureBox.NSCEPictureBoxCtrl.1",...

NS Basic/Desktop

AddObject "PictureBox" uses a lightweight version of this control which is built into your program, much like the other intrinsic controls. To use the full control described in this Tech Note, use AddObject "NSCEPictureBox.NSCEPictureBoxCtrl.1",... or add it to the Toolbox in the IDE using the ActiveX Control Manager.

General

If your program uses this control, you will also need to redistribute NSCEPictureBox.ocx and register it on the target machine.

The PictureBox is also used as a container for forms. As a result, the functions in PictureBox are directly available for use on any form. Here is a list of features in NS Basic's PictureBox:

The PictureBox maintains the picture being displayed as an image, which is not necessarily the same width and/or height as the PictureBox. You can have the PictureBox automatically size itself to the width and height of the image or have the image stretched or shrunk to the size of the PictureBox when displayed. All drawing and pixel manipulation is done on the image.

Tips

  1. If your image does not load, try setting the property.ImageLoadBufferSize = 4096
  2. Use .DrawMouseMoveLine or .DrawMouseMoveLineEx methods in the _MouseDown, _MouseMove and _MouseUp events to draw smother lines with the
  3. The LostFocusX and GotFocusX events need to be used to track the focus of the control.

PictureBox Reference
Properties
Events
Methods
 

Properties

AnimationAvailable
 
Values:
True|False
 
Description:
Returns True if animation is available for the image displayed. (Read Only)
AnimationInterval
 
Values:
0-65535
 
Description:
Sets or returns a value indicating whether the PictureBox will animate the image displayed with the PlayingCard property The AnimationInterval is in milliseconds. Setting the AnimationInterval property to a value greater than 0 will enable the animation. 1000=one second. Currently only available with the PlayingCard property set to 62 (Haunted Castle), 63(Bubbling Fish), 64 (Cheating Hand), 65(Helpful Robot), with the WildCard property set to True, or with the PlayingCard property set to any of the face cards or 53 (the Joker).
Appearance
 
Values:
-4, -3, -2, -1, 0, 1, 2, 3, 4
 
Description:
Sets or returns a value indicating the appearance of the PictureBox. The Appearance property has no effect if BorderStyle property is not set to 1.
Interactions between BorderStyle and Appearance properties. BorderStyle
0 1
Appearance 4 No Border Single Line Border Including Scrollbars
3 No Border 3D Raised Border Including Scrollbars 
2 No Border 3D Raised Border (Tiles)
1 No Border 3D Raised Border (Soft)
0 No Border Single Line Border
-1 No Border 3D Sunken Border (Soft)
-2 No Border 3D Sunken Border (Tiles)
-3 No Border 3D sunken Border Including Scrollbars
-4 No Border 3D sunken Border Frame Including Scrollbars
AutoRefresh
 
Values:
True|False
 
Description:
Sets or returns a value indicating whether the PictureBox will automatically refresh after image manipulation.
AutoSize
 
Values:
True|False
 
Description:
Sets or returns a value indicating whether the PictureBox will automatically change to the size of the image being displayed.#
BackColor
 
Values:
color
 
Description:
Sets or returns the background color of the PictureBox.
BitmapOnClipboard
 
Values:
True|False
 
Description:
Returns True if there is a bitmap image on the clipboard. (Read Only)
BorderStyle
 
Values:
0, 1
 
Description:
Sets or returns a value indicating the border style of the PictureBox. Can be used with the Appearance property to display 3D borders.
BorderStyle Description
0 No Border
1 Single line border
Caption
 
Values:
string
 
Description:
Sets or returns the caption to be used when in command button mode.
Center
 
Values:
0, 1, 2, 3
 
Description:
Sets or returns a value indicating whether the PictureBox will automatically center the image being displayed in the PictureBox.
Center Horizontally Vertically
0 No No
1 Yes No
2 No Yes
3 Yes Yes
Clip
 
Values:
True|False
 
Description:
Sets or returns a value indicating whether the image should be clipped when it is loaded when used with the hBitmap, Picture, PlayingCard, ResourceBitmapID properties. Only a portion of the image is kept and it is not resized. Used with the ClipHeight, ClipLeft, ClipTop, and ClipWidth FillColor properties. You can increase the size of the overall image without resizing the existing image. The new area not covered by the clipped existing image will be filled with the color in the FillColor property.
ClipHeight
 
Values:
integer
 
Description:
Sets or returns the number of pixels from top edge of original image to bottom edge of image to clip. Used with the ClipImage method, Clip, ClipLeft, ClipTop, and ClipWidth properties.
ClipLeft
 
Values:
integer
 
Description:
Sets or returns the number of pixels from left edge of original image to left edge of image to clip. Used with the ClipImage method, Clip, ClipHeight, ClipTop, and ClipWidth properties.
ClipTop
 
Values:
integer
 
Description:
Sets or returns the number of pixels from top edge of original image to top edge of image to clip. Used with the ClipImage method, Clip, ClipHeight, ClipLeft, and ClipWidth properties.
ClipWidth
 
Values:
integer
 
Description:
Sets or returns the number of pixels from left edge of original image to right edge of image to clip. Used with the ClipImage method, Clip, ClipHeight, ClipLeft,  and ClipTop properties.
CommandButton
 
Values:
True|False
 
Description:
Sets or returns the whether the PictureBox control should behave like a command button.
CommonBitmapID
 
Values:
integer
 
Description:
Sets or returns a value indicating which Common Controls Bitmap should or is being shown. Set CommonBitmapType property before setting CommonBitmapID property. Setting this property will cause the image to be loaded and displayed in the PictureBox.
CommonBitmapID CommonBitmapType
  -1 or 1 -2 or 2
  Bitmap Description
-1 (Read Only) No Bitmap No Bitmap
0 Cut Bitmap Large Icons Bitmap
1 Copy Bitmap Small Icons Bitmap
2 Paste Bitmap List Bitmap
3 Undo Bitmap Details Bitmap
4 Redo Bitmap Sort By Name Bitmap
5 Delete Bitmap Sort By Size Bitmap
6 File New Bitmap Sort By Date Bitmap
7 File Open Bitmap Sort By Type Bitmap
8 File Save Bitmap Parent Folder Bitmap
9 Print Preview Bitmap Net Connect Bitmap
10 Properties Bitmap Net Disconnect Bitmap
11 Help Bitmap New Folder Bitmap
12 Find Bitmap Illegal value
13 Replace Bitmap Illegal value
14 Print Bitmap Illegal value
CommonBitmapType
 
Values:
integer
 
Description:
Sets or returns a value indicating which Type Common Controls bitmap should or is being shown. Set CommonBitmapType property before setting CommonBitmapID property.
CommonBitmapType Description
-2 Disabled View Bitmaps
-1 Disabled Standard Bitmaps
0 No Bitmap
1 Enabled Standard Bitmaps
2 Enabled View Bitmaps
FillColor
 
Values:
color
 
Description:
Sets or returns the fill color to be used when manipulating an image in the PictureBox. This property defaults to the color white.
FillStyle
 
Values:
0, 1
 
Description:
Sets or returns the fill style to be used when manipulating an image in the PictureBox.
FillStyle Description
0 Solid - Will be filled in the color in the FillColor property.
1 Transparent - the background will show through.
FocusRect
 
Values:
True|False
 
Description:
Sets or returns whether a focus rectangle should be drawn when the PictureBox has focus.
FocusRectIndentBottom
 
Values:
integer
 
Description:
Sets or returns the number of pixels the focus rectangle will be indented from the bottom edge of the control. 
FocusRectIndentLeft
 
Values:
integer
 
Description:
Sets or returns the number of pixels the focus rectangle will be indented from the left edge of the control. 
FocusRectIndentRight
 
Values:
integer
 
Description:
Sets or returns the number of pixels the focus rectangle will be indented from the right edge of the control. 
FocusRectIndentTop
 
Values:
integer
 
Description:
Sets or returns the number of pixels the focus rectangle will be indented from the top edge of the control. 
FontBold
 
Values:
True|False
 
Description:
Sets or returns the BOLD setting of the font.
FontItalic
 
Values:
True|False
 
Description:
Sets or returns the ITALIC setting of the font.
FontName
 
Values:
string
 
Description:
Sets or returns the name of the font.
FontSize
 
Values:
integer
 
Description:
Sets or returns the point size setting of the font.
FontStrikethru
 
Values:
True|False
 
Description:
Sets or returns the STRIKETHRU setting of the font. 
FontTransparent
 
Values:
True|False
 
Description:
Sets or returns whether the text background will be transparent. 
FontUnderline
 
Values:
True|False
 
Description:
Sets or returns the UNDERLINE setting of the font.
FontWeight
 
Values:
integer
 
Description:
Sets or returns the FONTWEIGHT setting of the font. 
ForeColor
 
Values:
color
 
Description:
Sets or returns the foreground color to be used when drawing text in the PictureBox. 
hBitmap
 
Values:
integer
 
Description:
Sets or returns the HBITMAP of the image. This should only be used to set the hBitmap property of one PictureBox to the hBitmap property of another PictureBox. This is used to copy the image from one PictureBox to another PictureBox. Setting this property will cause the image to be loaded and displayed in the PictureBox.
Height
 
Values:
integer
 
Description:
Sets or returns the number of pixels from the top edge to the bottom edge of the PictureBox.
hFont
 
Values:
integer
 
Description:
Sets or returns the HFONT to be used when drawing text. This should only be used to set the hFont property of one PictureBox to the hFont property of another PictureBox.
HScrollPosition
 
Values:
integer
 
Description:
Sets or returns the horizontal scrollbar position.
hWnd
 
Values:
integer
 
Description:
Returns the hWnd of the PictureBox control. (Read Only)
ImageBitsPerPixel
 
Values:
integer
 
Description:
Sets or returns a value indicating the number of bits per pixel (color depth) of the image.
Bits Per Pixel Number Of Colors
1 2
2 4
4 16
8 256
16 65,535
24 16,777,216
ImageHeight
 
Values:
integer
 
Description:
Returns the height of the image from the file. (Read Only)
ImageLoadBitsPerPixel
 
Values:
integer
 
Description:
Sets or returns a value indicating the number of bits per pixel (color depth) of the image to use when loading images with the Picture property. (If ImageLoadBufferSize = 0, ImageLoadBitsPerPixel might be ignored.)
Bits Per Pixel Number Of Colors
1 2
2 4
4 16
8 256
16 65,535
24 16,777,216
ImageLoadBufferSize
 
Values:
integer
 
Description:
Returns or sets the buffer size used when loading an image with the Picture property. (Default: ImageLoadBufferSize = 0, which will use the height and width from the file instead of ImageLoadMaxHeight and ImageLoadMaxWidth properties and will attempt to use the bits per pixel value from the file instead of ImageLoadBitsPerPixel property when loading images with the Picture property.
ImageLoaded
 
Values:
True|False
 
Description:
Returns True if the PictureBox currently has an image loaded. (Read Only)
ImageLoadMaxHeight
 
Values:
integer
 
Description:
Return or sets the maximum image height when loading images with the Picture property. (If ImageLoadBufferSize = 0, ImageLoadMaxHeight will be ignored.)
ImageLoadMaxWidth
 
Values:
integer
 
Description:
Return or sets the maximum image width when loading images with the Picture property. (If ImageLoadBufferSize = 0, ImageLoadMaxWidth will be ignored.)
ImageWidth
 
Values:
integer
 
Description:
Returns the width of the image from the file. (Read Only)
Invert
 
Values:
True|False
 
Description:
Sets or returns a value indicating whether the colors of the image will be inverted when loaded into the PictureBox when used with the hBitmap, Picture, PlayingCard, ResourceBitmapID properties. This may not work properly on Windows CE 4.2 and Pocket PC 2003 devices. The workaround is to add this line of code:
						if picturebox.pixel(0,0)=0 then picturebox.InvertImage
						
Left
 
Values:
integer
 
Description:
Sets or returns the number of pixels from the left edge of the output window to the left edge of the PictureBox.
Mirror
 
Values:
0, 1, 2, 3
 
Description:
Sets or returns a value indicating whether the picture will be mirrored in the PictureBox when loading the image with the hBitmap, Picture, PlayingCard, ResourceBitmapID properties or the MirrorImage method.
Mirror Horizontally Vertically
0 No No
1 Yes No
2 No Yes
3 Yes Yes
MouseMovePoints
 
Values:
0, 1, 2
 
Description:
Sets or returns the mode of dealing with extra mouse move points.
MouseMovePoints Description
0
Do not capture or use extra mouse move points. This option takes the fewest CPU cycles.
1
Capture extra mouse move points and send them through the MouseDown event. This option takes the most CPU cycles.
2
Capture extra mouse move points and make them available to DrawMouseMoveLines,   DrawMouseMoveLinesEx, and GetMouseMovePoint methods, but do not send them through the MouseMove event. This option is the best trade off between CPU cycles and amount of detail in drawing.
MouseMovePointsCount
 
Values:
integer
 
Description:
Returns the number of mouse move points stored for the DrawMouseMoveLines,   DrawMouseMoveLinesEx, and GetMouseMovePoint methods. (Read Only)
Name
 
Values:
string
 
Description:
Returns the name of the PictureBox. (Read Only)
OnToolbar
 
Values:
True|False
 
Description:
Sets or returns a value indicating whether the PictureBox should place itself on the NS Basic Toolbar. (NS Basic Only) Does not work with Pocket PC's yet.
Overlay
 
Values:
True|False
 
Description:
Sets or returns a value indicating whether the image being loaded should be overlaid on the existing image when used with the hBitmap, Picture, PlayingCard, ResourceBitmapID properties.
OverlayLeft
 
Values:
integer
 
Description:
Sets or returns the number of pixels from left edge of original image to left edge of new image. Used with the Overlay and OverlayTop properties.
OverlayTop
Values:
integer
Description:
Sets or returns the number of pixels from top edge of original image to top edge of new image. Used with the Overlay and OverlayLeft properties.
OverlayTransparentColor
Values:
-1, color
Description:
Returns or sets the color to be used as a transparent color when overlaying the image. No transparent color will be used if this property is set to -1.
ParentHWnd
Values:
integer, read only
Description:
Returns the HWnd of the parent window.
PenFillStyle
Values:
0, 1
Description:
Sets or returns the pen fill style to be used when manipulating an image in the PictureBox and the PenStyle property =  2.
PenFillStyle
Description
0 Solid - Will be filled in the color in the BackColor property.
1 Transparent - the background will show through.
PenStyle
Values:
0, 1, 2
Description:
Sets or returns the pen style to be used when drawing a line with a width of 1. If the DrawWidth property  > 1 then the PenStyle property is assumed to be 1.
PenStyle Description
0 No Line
1 Solid Line
2 Dash Line
Picture
Values:
string
Description:
Set or Returns a string with name of image file.
Setting this property will cause the image to be loaded and displayed in the PictureBox.
Pixel(x, y)
Values:
color
Description:
Set or returns the color of the pixel in the image at the position specified by x and y. Note: The x and y are coordinates on the image which may or may not correspond to the coordinates of the PictureBox.
PlayingCard
Values:
integer
Description:
Sets or returns the numeric id of a playing card to display. Setting this property will cause the image to be loaded and displayed in the PictureBox.
PlayingCard Description Animation Available HPC Animation Available PPC Animation Available Desktop
1-13 Ace through King of Clubs True (Jack, Queen, and King) False True (Jack, Queen, and King)
14-26 Ace through King of Diamonds True (Jack, Queen, and King) False True (Jack, Queen, and King)
27-39 Ace through King of Hearts True (Jack, Queen, and King) False True (Jack, Queen, and King)
40-52 Ace through King of Spades True (Jack, Queen, and King) False True (Jack, Queen, and King)
53 Ghost Card Back (Desktop)
Same as 153 (HPC, HPC PRO and PPC) 
False
54 Thatched 1 Card Back (Desktop)
Same as 154 (HPC, HPC PRO and PPC) 
False
55 Thatched 2 Card Back (Desktop)
Same as 155 (HPC, HPC PRO and PPC) 
False
56 Helpful Robot Card Back (Desktop)
Same as 156 (HPC, HPC PRO and PPC) 
True
57 Roses Card Back (Desktop)
Same as 157 (HPC, HPC PRO and PPC) 
False
58 Flowers 1 Card Back (Desktop)
Same as 158 (HPC, HPC PRO and PPC) 
False
59 Flowers 2 Card Back (Desktop)
Same as 159 (HPC, HPC PRO and PPC) 
False
60 Fishes 1 Card Back (Desktop) False
61 Fishes 2 Card Back (Desktop)
WIN32_WCE Horse card back (HPC)
Rocket Ship (HPC PRO, HPC 2000)
Dragon card back (PPC)
True (False on HPC) True (False on Palmsize PC) False
62 Card Back 10 (Desktop)
Haunted Castle
card back (HPC)
Pyramid card back (PPC)
True True False
63 Haunted Castle Card Back (Desktop)
Bubbling Fish
card back (HPC)
? card back (PPC)
True True True
64 Beach Card Back (Desktop)
Cheating Hand
card back
True True True
65 Cheating Hand Card Back (Desktop)
Helpful Robot
card back (HPC)
Clover card back (PPC)
True False True
66 Sailboat card back (HPC, HPC PRO, PPC)  False True
67 X card (Desktop) False
68 O card (Desktop) False
78 O card (HPC, HPC PRO, PPC) False False
79 X card (HPC, HPC PRO, PPC) False False
80 Ghost card  (HPC, HPC PRO, PPC) False False
153 Joker True False True
154 Blank card False False False
155 Blank face card False False False
156-159 Suit cards
(Clubs, Diamonds, Hearts, Spades)
False False False
Resize
Values:
True|False
Description:
Sets or returns a value indicating the whether the image will be resized (stretched or shrunk) when loading the image with the hBitmap, Picture, PlayingCard, ResourceBitmapID properties. Used with the ResizeHeight and ResizeWidth properties.
ResizeHeight
Values:
integer
Description:
Sets or returns the number of pixels from top edge to bottom edge of the resized image. Used with the ResizeImage method, Resize and ResizeWidth properties.
ResizeWidth
Values:
integer
Description:
Set or returns the number of pixels from left edge to right edge of the resized image. Used with the ResizeImage method, Resize and ResizeHeight properties.
ResourceBitmapID
Values:
integer
Description:
Sets or returns the numeric resource id of a bitmap in an executable to display.
Set the ResourceFile property before setting this property. Setting this property will cause the image to be loaded and displayed in the PictureBox.
ResourceBitmapIDstr
Values:
string
Description:
Sets or returns the string resource id of a bitmap in an executable to display. (Available Version 1.3)
Set the ResourceFile property before setting this property. Setting this property will cause the image to be loaded and displayed in the PictureBox.
ResourceFile
Values:
string
Description:
Sets or returns a string with name of resource file (.dll, .ocx, .cpl, etc...) in which to get the bitmap resource from. Set the ResourceBitmapID property after setting this property.
ResourceFileLoaded
Values:
True|False
Description:
Returns a value indicating the whether a resource file has been successfully loaded. Set the ResourceBitmapID or ResourceIconID properties before reading this property. (Read Only)
ResourceIconID
Values:
integer
Description:
ReturSets or returns the numeric resource id of an icon in an executable to display.
Set the ResourceFile property before setting this property. Setting this property will cause the image to be loaded and displayed in the PictureBox.
Rotate
Values:
0, 90, 180, 270
Description:
Sets or returns a value indicating the rotation of the picture in the PictureBox when loading the image with the hBitmap, Picture, PlayingCard, ResourceBitmapID properties or the RotateImage method.
Rotate Description
0 No rotation will be done
90 Rotate image 90 degrees clockwise
180 Rotate image 180 degrees clockwise
270 Rotate image 270 degrees clockwise
ScaleMode
Values:
3
Description:
Sets or returns a value indicating the Scale Mode of the PictureBox. Currently only Scale Mode 3 is supported.
ScreenBitsPerPixel
Values:
integer
Description:
Returns a value indicating the number of bit per pixel (color depth) of the physical screen. (Read Only)
Bits Per Pixel Number Of Colors
1 2
2 4
4 16
8 256
16 65,535
24 16,777,216
ScreenHeight
Values:
integer
Description:
Returns a value indicating the number of pixels from the top edge to the bottom edge of the physical screen. (Read Only)
ScreenLeft
Values:
integer
Description:
Returns the number of pixels from left edge of the physical screen to left edge of the PictureBox. (Read Only)
ScreenTop
Values:
integer
Description:
Returns the number of pixels from top edge of the physical screen to top edge of the PictureBox. (Read Only)
ScreenWidth
Values:
integer
Description:
Returns a value indicating the number of pixels from the left edge to the right edge of the physical screen.. (Read Only)
Scroll
Values:
True|False
Description:
Sets or returns a value indicating whether the image should be scrolled when it is loaded when used with the hBitmap, Picture, PlayingCard, ResourceBitmapID properties. Used with the ScrollX and ScrollY properties.
ScrollBars
Values:
integer
Description:
Sets or returns a value indicating whether scroll bars will be displayed on the PictureBox control.
ScrollBars Horizontal Vertical
0 No No
1 Yes No
2 No Yes
3 Yes Yes
ScrollX
Values:
integer
Description:
Returns a value indicating the number of pixels to scroll the image horizontally.. Used with the Scroll and ScrollY properties and the ScrollImage method.
ScrollY
Values:
integer
Description:
Returns a value indicating the number of pixels to scroll the image vertically.. Used with the Scroll and ScrollX properties and the ScrollImage method.
Stretch
Values:
True|False
Description:
Sets or returns a value indicating whether the PictureBox will stretch (or shrink) the display of the image to the size of the PictureBox. This will not change the size of the image, but will stretch or shrink the display of it.
Tag
Values:
variant
Description:
User defined.
TapAndHoldEventEnabled
Values:
True/False
Description:
Turns on the TapAndHoldEvent.
Top
Values:
integer
Description:
Set or returns the number of pixels from the top edge of the output window to the top edge of the PictureBox.
TransparentColor
Values:
-1, color
Description:
Returns or sets the color to be used as a transparent color when displaying the image. No transparent color will be used if this property is set to -1.
UseJPEGBitsPerPixel
Values:
True|False
Description:
Returns or sets a value indicating whether the BitsPerPixel value in the JPEG file should be used.
Version
Values:
integer
Description:
Returns the version of the PictureBox (i.e. 207). (Read Only)
VersionMajor
Values:
integer
Description:
Returns the major version of the PictureBox (i.e. 2). (Read Only)
VersionMinor
Values:
integer
Description:
Returns the minor version of the PictureBox (i.e. 7). (Read Only)
Visible
Values:
True|False
Description:
Sets or returns value indicating whether the PictureBox is visible.
VScrollPosition
Values:
integer
Description:
Sets or returns the vertical scrollbar position.
WaitCursor
Values:
True|False
Description:
Set or returns a value indicating whether the PictureBox will display a Wait Cursor while loading, mirroring, saving, or rotating the image.
Width
Values:
integer
Description:
Set or returns the number of pixels from the left edge to the right edge of the PictureBox.
WildCard
Values:
integer
Description:
Sets or returns a value indicating whether a "WILD" indicator should appear on the image. This a intended to be used with the images displayed with the PlayingCard property. The indicator can be animated with the AnimationInterval property.
WildCard Description
0 No indicator
1 Horizontal Indicators
2 Vertical Indicators
3 Center Indicator

Events

Click
args:
Description:
Standard Click event.
DblClick
args:
Description:
Standard Double Click event.
GotFocus
GotFocusX
args:
Description:
Standard GotFocus event. Use GotFocusX in NS Basic
HScroll
args:
nSBCode, bRefresh, nPos, nMove, nMin, nMax, nPage, nCX, nCY
Description:
Event called upon user scrolling.
KeyDown
args:
keycode, shift
Description:
Standard KeyDown event.
KeyPress
args:
keycode, shift
Description:
Standard KeyPress event.
KeyUp
args:
keycode, shift
Description:
Standard KeyUp event.
LostFocus
LostFocusX
args:
 
Description:
Standard LostFocus event. Use LostFocusX in NS Basic.
MouseDown
args:
button, shift, x, y
Description:
PictureBox is in contact with stylus or input device.
MouseMove
args:
button, shift, x, y
Description:
Stylus or input device is moved while in contact with the PictureBox.
MouseUp
args:
button, shift, x, y
Description:
Stylus is lifted from PictureBox, or input device breaks contact with PictureBox.
TapAndHold
args:
button, shift, x, y
Description:
The user has done a "tap and hold" on the PictureBox. The property TapAndHoldEnabled must be set to True.(Pocket PC Only)
VBCEAutoSize
args:
width, height
Description:
Called when the PictureBox control needs to resize itself and VBCE container will not let it. The Width and Height properties of the PictureBox control should be set in this event.
VScroll
args:
nSBCode, bRefresh, nPos, nMove, nMin, nMax, nPage, nCX, nCY
Description:
Event called upon user scrolling.

Methods

AboutBox
Parameter(s):
Description:
Displays the About Box for the PictureBox control.
Animate
Parameter(s):
Description:
Does the animation of the image if the AnimationAvailable property is set to True.
CaptureScreen
Parameter(s):
Description:
Loads a copy of the physical screen into the image and displays it in the PictureBox.
ClipImage
Parameter(s):
Description:
Clips the image that is displayed in the PictureBox control using the ClipHeight, ClipLeft, ClipTop, ClipWidth, and FillColor properties.
Cls
Parameter(s):
Description:
Clears the image from the PictureBox control.
Copy
Parameter(s):
Description:
Copies the image from the PictureBox control to the clipboard. Returns True if an image was copied.
CreateImage
Parameter(s):
width, height
Description:
Creates an image of the specified size and of the color specified in the FillColor property.
DrawCircle
Parameter(s):
x, y, radius [, color [, aspectratio]]
Description:
Draws a circle centered on x, y with a radius of radius and the aspect ratio of aspectratio.  Set aspectratio to 1 for a normal circle. The circle is drawn with color color and filled in with the FillColor property. Used with FillStyle, FillColor, PenStyle, and PenFillStyle properties.
DrawIcon
Parameter(s):
file [,[id] [,largesize]]
Description:
Draws an icon from a file (an executable, a dll, or an ico file). id should be 0 or the resource id of the icon. largesize should be true if you want to use the large icon from the resource. Calling this method will cause the icon to be loaded and displayed in the PictureBox.
DrawLine
Parameter(s):
fromX, fromY, toX, toY [, color [, box [, fill]]]
Description:
Draws a line from (fromX, fromY) to (toX, toY) with color. If box is true, this will draw a box using the coordinates to specify opposite corners. If box and Fill are true it will draw a box and fill it with the same color used to draw it. You can also use DrawRoundRect with arcwidth = 0 and archeight = 0 to draw a box.
DrawMouseMoveLine
Parameter(s):
color
Description:
Draws a line using the mouse move points with color.
DrawMouseMoveLineEx
Parameter(s):
fromX, fromY, toX, toY, color
Description:
Draws a line from (fromX, fromY) to the mouse move points stored to (toX, toY) with color.
DrawPicture
Parameter(s):
filename, x1, x2 [, width1, height1 [, x2, y2, width2, height2 [,rasterop]]]
Description:
Draws part or all of a image file on the PictureBox.
DrawPoint
Parameter(s):
x, y [, color]
Description:
Draws a pixel at x, y with color color. This is the same as Pixel(x,y) = color
DrawPolygon
Parameter(s):
points [, color]
Description:
Draws a polygon of points vertices connected by straight lines. The polygon is drawn with color color and filled in with the FillColor property. The points can be from 2 to 20. The polygon is closed automatically by drawing a line from the last vertex to the first. Used with FillStyle, FillColor, PenStyle, and PenFillStyle properties and SetPointArray method.
DrawPolyLines
Parameter(s):
points [, color]
Description:
Draws a series of line by connecting the specified number of points. The lines are drawn with color color.  The points can be from 2 to 20. Used with FillStyle, FillColor, PenStyle, and PenFillStyle properties and SetPointArray method.
AddObject "picturebox","P",1,1,100,100
p.SetPointArray 1,1,1
p.SetPointArray 2,1,50
p.setPointArray 3,50,50
p.setPointArray 4,50,1
p.drawPolygon 4
DrawRoundRect
Parameter(s):
left, top, right, bottom [, arcwidth, archeight [, color]]
Description:
Draws a rectangle with color color bounded by left, top and right, bottom with rounded corners of arcwidth width and archeight height. Setting arcwidth and archeight to 0 will draw a normal rectangle. The round rectangle is drawn with color color and filled in with the FillColor property. Used with FillStyle, FillColor, PenStyle, and PenFillStyle properties.
DrawText
Parameter(s):
text [, x, y [, color]]
Description:
Draws a line of text at optional coordinates x, y using optional color color
GetMouseMovePoint
Parameter(s):
point, x, y
Description:
Returns the x and y coordinates of point. Point can be from 0 to the value return from the MouseMovePoints property - 1.
IntensityBlue
Parameter(s):
color
Description:
Returns the blue intensity from a color.
IntensityGreen
Parameter(s):
color
Description:
Returns the green intensity from a color.
IntensityRed
Parameter(s):
color
Description:
Returns the red intensity from a color.
InvertImage
Parameter(s):
 
Description:
Inverts the colors of the image that is displayed in the PictureBox.
MirrorImage
Parameter(s):
 
Description:
Mirrors the image that is displayed in the PictureBox using the Mirror property setting.
Hide
Parameter(s):
 
Description:
Hides the PictureBox and sets the Visible property to False.
Move
Parameter(s):
left, top, width, height
Description:
Move the PictureBox to new left and top location and resizing to width and height.
Paste
Parameter(s):
 
Description:
Copies the image from the clipboard to the PictureBox control. Returns True if an image was pasted.
QBColor
Parameter(s):
colorcode
Description:
Returns a color based on the colorcode  used by earlier versions of Basic.
ColorCode Description
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Yellow
7 White
8 Gray
9 Light Blue
10 Light Green
11 Light Cyan
12 Light Red
13 Light Magenta
14 Light Yellow
15 Bright White
Refresh
RefreshX
Parameter(s):
 
Description:
Redraws the image in the PictureBox control.. Use RefreshX in VBCE.
RefreshDesktopWallpaper
Parameter(s):
 
Description:
Causes the Desktop to redraw the wallpaper.
ReleaseCapture
Parameter(s):
 
Description:
Deactivates the PictureBox to receive the all mouse input.
ResizeImage
Parameter(s):
 
Description:
Resizes the image in the PictureBox control using the ResizeHeight and ResizeWidth properties.
RGB
Parameter(s):
red, green, blue
Description:
Returns a color comprised of the red, green, and blue intensities.
RotateImage
Parameter(s):
 
Description:
Rotates the image that is displayed in the PictureBox using the Rotate property setting.
SaveImageToFile
Parameter(s):
filename, filetype
Description:
Save the image in the PictureBox as a .bmp file to the filename specified. Filename is a string, filetype is an integer. The path specified in the filename MUST already exist. Returns True if the file was saved, otherwise returns False.
filetype Description Extension That Should Be Used
0 Bitmap .bmp
ScrollImage
Parameter(s):
 
Description:
Scrolls the image in the PictureBox using the ScrollX and ScrollY properties.
SetCapture
Parameter(s):
 
Description:
Activates the PictureBox to receive the all mouse input.
SetFocus
Parameter(s):
 
Description:
Activates the PictureBox to receive the focus.
SetPointArray
Parameter(s):
index, x, y
Description:
Sets the pointarray index to x and y. Used with the DrawPolyLines and DrawPolygon methods. The index can be from 1 to 20.
Show
Parameter(s):
 
Description:
Makes the PictureBox visible and sets the Visible property to True.
TextHeight
Parameter(s):
string
Description:
Returns the height of the string using the current font.
TextWidth
Parameter(s):
string
Description:
Returns the width of the string using the current font.
ZOrder
Parameter(s):
position
Description:
Places the PictureBox control at the front or back of the z-order.
ZOrder Position 0 PictureBox will be placed at the front of the z-order
1 PictureBox will be placed at the back of the z-order. Unfortunately, using ZOrder 1 with NS Basic, the PictureBox is placed behind the output window.

 

Sample Code

 

rem Play around with some picturebox functions

output.backcolor=vbwhite
output.scalemode=3
output.drawpicture "\windows\startup.bmp",300,0
output.drawcircle 150,150,25
output.drawcircle 250,100,25
output.drawText "this is drawtext"
output.drawText "this is some more drawtext"
print
print

addObject "picturebox","pic",200,0,50,50
pic.borderstyle=1

sub pic_click
  print "pic click"
  pic.move 1200,1200
end sub

sub output_click
  print "click in Output" 
end sub

sub output_mousedown(button, shift, x, y)
  print "mouse down: button:" & button & " Shift:" &  shift & " X:" & x & " Y:" & y
end sub