How to get current resolution(100分)

  • 主题发起人 主题发起人 nickname
  • 开始时间 开始时间
All you want are here:<br>http://www.gislab.ecnu.edu.cn/delphibbs/DispQ.asp?LID=125378
 
&lt;a href="http://www.gislab.ecnu.edu.cn/delphibbs/DispQ.asp?LID=125378"&gt;http://www.gislab.ecnu.edu.cn/delphibbs/DispQ.asp?LID=125378&lt;/a&gt;
 
screen.width<br>screen.height
 
Victortim:呵呵,幽默。<br><br>
 
改分辨率不好改,得到还是很容易的。
 
to superMMX:每一个delphi应用(application)都定义了<br>&nbsp; &nbsp;Screen:TScreen;<br>就象预先定义的<br>&nbsp; &nbsp;application:Tapplication;<br>是一样的,查看一下TScreen类,你就知道了。
 
取得当前的屏幕分辨率设置,使用下面的程序应该可以:<br>//---------------------------------------------------------------//<br>// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 检测显示器分辨率 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//<br>//---------------------------------------------------------------//<br>procedure GetScreenSize(var X, Y: Longint);<br>begin<br>&nbsp; X := GetSystemMetrics(SM_CXSCREEN); // 显示器水平分辨率<br>&nbsp; Y := GetSystemMetrics(SM_CYSCREEN); // 显示器垂直分辨率<br>end;<br><br>//-------------------------------------------------------------<br>// &nbsp; &nbsp;Windows提供给我们两个API函数,可以动态调整显示器的分辨率,<br>// 他们是EnumDisplaySettings()和ChangeDisplaySettings()。<br>//-------------------------------------------------------------<br>function DynamicResolution(X, Y: Word): Boolean;<br>var<br>&nbsp; lpDevMode: TDeviceMode;<br>begin<br>&nbsp; Result := EnumDisplaySettings(nil, 0, lpDevMode);<br>&nbsp; if Result then<br>&nbsp; begin<br>&nbsp; &nbsp; lpDevMode.dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;<br>&nbsp; &nbsp; lpDevMode.dmPelsWidth := X;<br>&nbsp; &nbsp; lpDevMode.dmPelsHeight := Y;<br>&nbsp; &nbsp; Result := ChangeDisplaySettings(lpDevMode, 0) = DISP_CHANGE_SUCCESSFUL;<br>&nbsp; end<br>end;<br><br>不妨试一试,如果满意,请给我来个 EMAIL.<br>
 
to Victortim:<br>&nbsp; 知道,呵呵,<br><br>全了。
 
多人接受答案了。
 
后退
顶部