Fórum Apresentar o Sistema sempre em 1024 x 768 #269432
21/02/2005
0
Como eu faço para sempre que o usuário entrar no sistema deixar a resolução 1024 x 768. ???
Ou como eu posso dimensionar todos os componentes para a resolução da máquinha???
Andre_luis_c
Curtir tópico
+ 0Posts
21/02/2005
Denis
if (Screen.Width < 1024 ) and (Screen.Height < 768) then
application.MessageBox(´Sua definição de tamanho de tela é inválido. Você poderá ter problemas para visualizar a tela. Mude para no mínimo 1024 x768.´,´Aviso´,mb_iconinformation);
Gostei + 0
21/02/2005
Silviogs
- Coloque um ListBox no form
- Modifique o OnCreate do form assim:
procedure TForm1.FormCreate(Sender: TObject);
var
i : Integer;
DevMode : TDevMode;
begin
i := 0;
while EnumDisplaySettings(nil,i,Devmode) do begin
with Devmode do
ListBox1.Items.Add(Format(´¬dx¬d ¬d Colors´,
[dmPelsWidth,dmPelsHeight, 1 shl dmBitsperPel]));
Inc(i);
end;
end;
- Coloque um botão no form
- Altere o evento OnClick do botão conforme abaixo:
procedure TForm1.Button1Click(Sender: TObject);
var
DevMode : TDevMode;
begin
EnumDisplaySettings(nil,Listbox1.ItemIndex,Devmode);
ChangeDisplaySettings(DevMode,0);
end;
Silvio Guedes
Gostei + 0
21/02/2005
Silviogs
Implementation
const
ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}
ScreenHeight: LongInt = 600;
{$R *.DFM}
procedure TForm1.FormCreate (Sender: Tobject);
begin
scaled := true;
if (screen.width <> ScreenWidth) then
begin
height := longint(height) * longint(screen.height) DIV ScreenHeight;
width := longint(width) * longint(screen.width) DIV ScreenWidth;
scaleBy(screen.width, ScreenWidth);
end;
end;
Agora, você vai querer checar, se o tamanho dos fontes(de letra) estão OK. Antes de trocar p tamanho do fonte, você precisará ter
certeza de que o objeto realmente tem a propriedade fonte pela checagem da RTTI. Isso pode ser feito assim:
USES typinfo; {Add this to your USES statement.}
var
i:integer;
begin
for i := componentCount - 1 downto 0 do
with components[i] do
begin
if GetPropInfo(ClassInfo, ´font´) <> nil then
font.size := (NewFormWidth DIV OldFormWidth) * font.size;
end;
end;
{Esta é a maneira longa de fazer a mesma coisa}
var
i:integer;
p:PPropInfo;
begin
for i := componentCount - 1 downto 0 do
with components [i] do
begin
p := GetPropInfo (ClassInfo, ´font´);
if assigned (p) then
font.size := (NewFormWidth DIV OldFormWidth) * font.size;
end;
end;
Silvio Guedes
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)