Gets the dimensions of a control, window or image.
Contents |
array wb_get_size (mixed object [, bool lparam])
| object type | lparam |
|---|---|
| A control handle | Not used |
| A window handle | If TRUE, the area returned will not include the title bar and borders. Default is FALSE. |
| A ListView handle | If TRUE, the function returns an array with the widths of the column headers. |
| An icon handle | Not used |
| A bitmap handle | Not used |
| The name of a bitmap file | Not used |
| The name of an icon file | Not used |
| A string | May be a font object to get the size of a string in a specific font. If left blank, the default font is used. |
Generally it returns an array where the first element is the width and the second is the height. Measurements are in pixels. The function will return the integer WBC_MINIMIZED instead of an array if the requested window is minimized, or NULL on error.
<?php
// Obtain and print out various dimensions
define("PATH_RES", "../resources/");
// Get bitmap dimensions
print_r(wb_get_size(PATH_RES . "toolbar.bmp"));
$img = wb_load_image(PATH_RES . "toolbar.bmp");
print_r(wb_get_size($img));
// Get icon dimensions
$img = wb_load_image(PATH_RES . "ttf.ico");
print_r(wb_get_size($img));
print_r(wb_get_size(PATH_RES . "ttf.ico"));
// Get window dimensions
$mainwin = wb_create_window(NULL, PopupWindow, "Tests", 530, 320);
print_r(wb_get_size($mainwin));
// Get control dimensions
$label = wb_create_control($mainwin, Label, "", 10, 20, 120, 20);
print_r(wb_get_size($frame));
// Get column widths of a ListView
print_r(wb_get_size($list, true));
?>