Código PHP:
case WM_SIZE:
GetClientRect(hwnd, &coords); // obtenemos las coordenadas de la ventana
xCenter = ((coords.right - coords.left)/2) - (bm.bmWidth/2);
yCenter = ((coords.bottom - coords.top)/2) - (bm.bmHeight/2);
if(hBitmap){
RepintarImagen(hwnd, hBitmap);
}
//si la imagen es más pequeña que la ventana deshabilito los scrolls
if(bm.bmHeight < (coords.bottom - coords.top)){
VScroll.fMask = SIF_DISABLENOSCROLL;
SetScrollInfo(hwnd, SB_VERT, &VScroll, 1);
InvalidateRect(hwnd, &coords, TRUE);
}else{
VScroll.fMask = SIF_RANGE;
SetScrollInfo(hwnd, SB_VERT, &VScroll, 1);
}
if(bm.bmWidth < (coords.right - coords.left)){
HScroll.fMask = SIF_DISABLENOSCROLL;
SetScrollInfo(hwnd, SB_HORZ, &HScroll, 1);
InvalidateRect(hwnd, &coords, TRUE);
}else{
HScroll.fMask = SIF_RANGE;
SetScrollInfo(hwnd, SB_HORZ, &HScroll, 1);
}
break;