'put together by Semen Matusovski 'to be found at http://www.powerbasic.com/support/forums/Forum4/HTML/001729.html #COMPILE EXE #REGISTER NONE #INCLUDE "Win32Api.Inc" %ID_TextBox = 101 %ID_Button = 201 CALLBACK FUNCTION hDlg_CB() DIM BrushLtBr AS STATIC LONG, BrushWhite AS STATIC LONG, BrushBlue AS STATIC LONG SELECT CASE CBMSG CASE %WM_INITDIALOG LOCAL Lb AS LOGBRUSH Lb.lbStyle = %BS_SOLID Lb.lbColor = &H80C0FF: BrushLtBr = CreateBrushIndirect(Lb) FUNCTION = %TRUE CASE %WM_DESTROY DeleteObject BrushLtBr CASE %WM_CTLCOLORDLG ' Return the handle of the dialog background brush. FUNCTION = BrushLtBr CASE %WM_SIZE x& = LOWRD(CBLPARAM): y& = HIWRD(CBLPARAM) ' pixels DIALOG PIXELS CBHNDL, x&, y& TO UNITS xx&, yy& ' Relation sizes Left : 0.1 * Width of client area ' for TextBox Top : 0.05 * Height * of Client area ' Width : 0.8 * Width of client area ' Height : 0.2 * Height * of Client area CONTROL SET LOC CBHNDL, %Id_TextBox, 0.1 * xx&, 0.05 * yy& CONTROL SET SIZE CBHNDL, %Id_TextBox, 0.8 * xx&, 0.4 * yy& CONTROL SET TEXT CBHNDL, %Id_TextBox, "Width = " + STR$(x&) + " pixels " + $CRLF + _ "Height = " + STR$(y&) + " pixels" CONTROL SET LOC CBHNDL, %Id_Button, 0.1 * xx&, 0.65 * yy& CONTROL SET SIZE CBHNDL, %Id_Button, 0.8 * xx&, 0.2 * yy& END SELECT END FUNCTION FUNCTION PBMAIN () DIALOG NEW 0 ,"Resizing",0,0, 105, 90, %DS_CENTER OR %WS_OVERLAPPEDWINDOW TO hDlg& CONTROL ADD TEXTBOX, hDlg&, %ID_TextBox, "", 0, 0, 0, 0, %ES_WANTRETURN OR %ES_MULTILINE OR %ES_AUTOVSCROLL, %WS_EX_CLIENTEDGE CONTROL ADD BUTTON, hDlg&, %ID_Button, "This is a button", 0, 0, 0, 0 DIALOG SHOW MODAL hDlg&, CALL hDlg_CB END FUNCTION