Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Gráficos
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 02-01-2004
SMTZ SMTZ is offline
Miembro
 
Registrado: nov 2003
Posts: 225
Poder: 23
SMTZ Va por buen camino
Thumbs up

Pues finalmente parece ser que la ventana que yo estaba intentando reescalar no podia caber en una resolucion de 800X600, pero cuando la reescalaba a una resolucion superior a 1024X768 los componentes se adaptaban bien a la nueva resolución pero la ventana era demasiado grande. Para quien le interese, a partir de la información que he sacado de Internet he creado una unidad que me ha solucionado el problema que tenía:


unit UtilidadesU;

interface

Uses
Forms, Windows;

Type
TResolucion = Record

Ancho : Integer;
Alto : Integer;

End;

Procedure AdaptarResolucion ( Ventana : TForm;
AnchoTiempoDiseno,
AltoTiempoDiseno,
cPixelsPerInch,
cFontHeight : Integer );

Function ConocerResolucionWindows : TResolucion;

Function CambiarResolucionWindows ( Ancho, Alto : word): Boolean;

implementation

Procedure AdaptarResolucion ( Ventana : TForm;
AnchoTiempoDiseno,
AltoTiempoDiseno,
cPixelsPerInch,
cFontHeight : Integer );

{Esta función reescala los componentes de una ventana a una nueva resolución}

Var
OldFormWidth : integer;

begin

With TForm.Create ( Ventana ) Do
Begin

scaled := true;
if Screen.Width <> AnchoTiempoDiseno then
begin

OldFormWidth := width;
height := longint ( height ) * longint ( screen.height ) DIV AltoTiempoDiseno;
width := longint ( width ) * longint ( screen.width ) DIV AnchoTiempoDiseno;

scaleBy ( screen.width, AnchoTiempoDiseno );
font.size := ( Width DIV OldFormWidth ) * font.size;

end;

End; // With

End;


Function ConocerResolucionWindows : TResolucion;
Begin

ConocerResolucionWindows.Ancho := Screen.Width;
ConocerResolucionWindows.Alto := Screen.Height;

End;


Function CambiarResolucionWindows ( Ancho, Alto : word): Boolean;
var
lpDevMode: TDeviceMode;

begin

Result := EnumDisplaySettings ( nil, 0, lpDevMode );

if Result then
begin

lpDevMode.dmFields := DM_PELSWIDTH Or DM_PELSHEIGHT;
lpDevMode.dmPelsWidth := Ancho;
lpDevMode.dmPelsHeight := Alto;
Result := ChangeDisplaySettings ( lpDevMode, 0 ) = DISP_CHANGE_SUCCESSFUL;

end;

end;


end.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 11:46:28.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi