这个问题如何解决!(50分)

C

com.net

Unregistered / Unconfirmed
GUEST, unregistred user!
我有一台台式机14寸的显示器,公司是15寸的,我将程序拷到公司去,程序界面发生变化,
我知道和显示器尺寸有关,如何解决呢?
 
大家没有遇到过这个问题吗?
 
改变分辨率!
[:)]
 
elphi Tips
From The Cobb Group
Transtor:傅贵
97.10.27自动适应屏幕资源 (Delphi 3, 2.0 and 1.0)
You're always creating software that looks great at your monitor's resolution.
Unfortunately,
if you designed your application on a high-resolution screen, it may be larger
than the available screen space on the client screen. You can solve this
problem by letting Delphi automatically add scroll bars at run-time. However,
using Delphi's automatic scaling produces more professional results. At
run-time, Delphi asks the system for the screen resolution and stores it in
the PixelsPerInch property of your application's Screen object. Next, it uses
the PixelsPerInch value
to resize the form for the current resolution. Here are some things to remember,
to make this technique work effectively: set the Scaled property of your
form(s) to TRUE, use only TrueType fonts, use Windows small fonts when you develop,
and set the AutoScroll property of your form(s)
to FALSE.
 
看看客户的显示器分辨率是多少,就按多少的做不就行了?[:D]
 
大家可否给些代码我看看呀
 
可以在你的程序开始时(如Form的Create事件里),增加一个分辩率检测的代码,判断
你公司电脑的分辩率是不是和你家电脑里的一样,如果不是一样,就将你公司电脑的分
辩率设置为你家中电脑的分辩率。
 
我找找,你等着
 
找到了,贴给你:
function SetSize(X, Y: word): BOOL;
var
lpDevMode: TDeviceMode;
begin
Result := EnumDisplaySettings(nil, 0, lpDevMode);
if Result then
begin
lpDevMode.dmFields := DM_PELSWIDTH Or DM_PELSHEIGHT;
lpDevMode.dmPelsWidth := X;
lpDevMode.dmPelsHeight := Y;
Result := ChangeDisplaySettings(lpDevMode, 0) = DISP_CHANGE_SUCCESSFUL;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
if SetSize(640, 480) then
showMessage('我的程序要在800*600下执行,按确定后变成800*600');
//设置为800*600
SetSize(800, 600);
end;
 
我同意小唐
 
好,谢谢小唐。
 
呵呵,我赞成小唐的意见,但也反对采用检测分辨率的方法写程序。会使你的软件太个性化,
要是用户的机器硬件不能达到要求怎么办?不用软件么?
 
有自动根据分辨率改变窗体和控件大小的控件呀,你找找看。
 
控制控件位置
使他能做到自适应
 
改变分辨率是可以的,但是正如kingdeezj所说的,有的机器不能达到要求的,还有上面改变分辨率的程序运行时好象是不能更改刷新频率的。屏幕效果太差了。
 
我写的界面象来都是alClient。不会出现这种问题。[:D]
 
顶部