線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:839
推到 Plurk!
推到 Facebook!

解析度的問題

 
kraen4468
初階會員


發表:66
回覆:112
積分:35
註冊:2003-12-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-02-27 16:43:03 IP:61.222.xxx.xxx 未訂閱
這是delphi的程式    unit sw_resolution;    interface    uses   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,   Dialogs, StdCtrls;    type   TForm1 = class(TForm)     Button1: TButton;     Button2: TButton;     procedure Button1Click(Sender: TObject);     procedure Button2Click(Sender: TObject);   private     { Private declarations }   public     { Public declarations }   end;    var   Form1: TForm1;    function SetScreenResolution(Width, Height: integer): Longint;      implementation    {$R *.dfm}    function SetScreenResolution(Width, Height: integer): Longint; var   DeviceMode: TDeviceMode; begin   with DeviceMode do   begin     dmSize := SizeOf(TDeviceMode);     dmPelsWidth := Width;     dmPelsHeight := Height;     dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;   end;   Result := ChangeDisplaySettings(DeviceMode, CDS_UPDATEREGISTRY); end;    procedure TForm1.Button1Click(Sender: TObject); begin   SetScreenResolution(800, 600); end;    procedure TForm1.Button2Click(Sender: TObject); begin   SetScreenResolution(1024, 768); end;    end. 這是我轉成c++的程式 [code] //--------------------------------------------------------------------------- #include  #pragma hdrstop #include "winuser.h" #include "wingdi.h" #include "rotation1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; DEVMODE DeviceMode1; int Result; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- long int __fastcall TForm1::SetScreenResolution(int Height,int Width) { DeviceMode1.dmSize = sizeof(TDeviceMode); DeviceMode1.dmPelsWidth = Width; DeviceMode1.dmPelsHeight = Height; DeviceMode1.dmFields = DM_PELSWIDTH || DM_PELSHEIGHT; Result = ChangeDisplaySettings(&DeviceMode1 ,CDS_UPDATEREGISTRY); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { SetScreenResolution(800,600); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { SetScreenResolution(1024,768); } ~我還在學習狀態希望多多向您學習~
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-02-27 18:47:04 IP:61.218.xxx.xxx 未訂閱
這裡已有相關解決辦法 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=45545    此篇重複發問,請相關版主在三天後將此篇發問刪除... 也請發問者發問前注意發文請先看本站守則! http://delphi.ktop.com.tw/topic.php?TOPIC_ID=19264    
/*生活是一種藝術,用心生活才能享受生活*/
發表人 - axsoft 於 2004/02/27 18:49:51
系統時間:2024-05-05 21:25:09
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!