procedure TMainForm.newwinprocedure(var msg: tmessage);
var
bmpheight,bmpwidth:integer;
i,j:integer;
begin
msg.Result:=callwindowproc(oldwinproc,clienthandle,msg.Msg,msg.WParam,msg.LParam);
if msg.Msg=wm_erasebkgnd then
begin
bmpwidth:=mainform.Image1.Width;
bmpheight:=mainform.image1.Height;
if (bmpwidth<>0)and(bmpheight<>0) then
begin
outcanvas.Handle:=msg.WParam;
for i:=0 to mainform.ClientWidth div bmpwidth do
for j:=0 to mainform.ClientHeight div bmpheight do
outcanvas.Draw(i*bmpwidth,j*bmpheight,mainform.Image1.Picture.Graphic);
end;
end;
end;procedure TMainForm.FormCreate(Sender: TObject);
begin
newwinproc:=makeobjectinstance(newwinprocedure);
oldwinproc:=pointer(setwindowlong(clienthandle,gwl_wndproc,cardinal(newwinproc)));
outcanvas:=tcanvas.Create;
end;
在WIN2000,DELPHI6,17'纯平中全屏中不能显示为整个界面,图片为800*600.
var
bmpheight,bmpwidth:integer;
i,j:integer;
begin
msg.Result:=callwindowproc(oldwinproc,clienthandle,msg.Msg,msg.WParam,msg.LParam);
if msg.Msg=wm_erasebkgnd then
begin
bmpwidth:=mainform.Image1.Width;
bmpheight:=mainform.image1.Height;
if (bmpwidth<>0)and(bmpheight<>0) then
begin
outcanvas.Handle:=msg.WParam;
for i:=0 to mainform.ClientWidth div bmpwidth do
for j:=0 to mainform.ClientHeight div bmpheight do
outcanvas.Draw(i*bmpwidth,j*bmpheight,mainform.Image1.Picture.Graphic);
end;
end;
end;procedure TMainForm.FormCreate(Sender: TObject);
begin
newwinproc:=makeobjectinstance(newwinprocedure);
oldwinproc:=pointer(setwindowlong(clienthandle,gwl_wndproc,cardinal(newwinproc)));
outcanvas:=tcanvas.Create;
end;
在WIN2000,DELPHI6,17'纯平中全屏中不能显示为整个界面,图片为800*600.
解决方案 »
- 散尽最后一分,祝各位中秋节快乐!
- 有什么办法在Bitmap上画一段文字,中间使用多种颜色及字形
- 有没有这样显示主从表内容的表格控件?
- 诚问:Edit+updown怎么做才能是其每次的增量为0.1
- 更改屏幕刷新率的问题
- 快来呀,各位高手!!!在线等!!
- 请问如何监听ICMP报文??
- 源码相送!!从MDI中的子窗体,调用DLL中的子窗体!
- 请大家推荐详细介绍windows各消息含义的网站,up有分
- 我的socketconnection老连不上application server,这是怎么回事?
- 第一次用 fast report
- 有在移动工作的内部人员不?一边是中国移动,一边是有熟人的昌河,我该何去何从.(移动的待遇到底好不好啊)
bmpheight
不要取image1的宽和高
取screen.Width/screen.height
在FORMS.PAS单元中: Screen: TScreen;
这是TScreen的定义:TScreen = class(TComponent)
private
FFonts: TStrings;
FImes: TStrings;
FDefaultIme: string;
FDefaultKbLayout: HKL;
FPixelsPerInch: Integer;
FCursor: TCursor;
FCursorCount: Integer;
FForms: TList;
FCustomForms: TList;
FDataModules: TList;
FMonitors: TList;
FCursorList: PCursorRec;
FDefaultCursor: HCURSOR;
FActiveControl: TWinControl;
FActiveCustomForm: TCustomForm;
FActiveForm: TForm;
FLastActiveControl: TWinControl;
FLastActiveCustomForm: TCustomForm;
FFocusedForm: TCustomForm;
FSaveFocusedList: TList;
FHintFont: TFont;
FIconFont: TFont;
FMenuFont: TFont;
FAlignLevel: Word;
FControlState: TControlState;
FOnActiveControlChange: TNotifyEvent;
FOnActiveFormChange: TNotifyEvent;
procedure AlignForm(AForm: TCustomForm);
procedure AlignForms(AForm: TCustomForm; var Rect: TRect);
procedure AddDataModule(DataModule: TDataModule);
procedure AddForm(AForm: TCustomForm);
procedure CreateCursors;
procedure DeleteCursor(Index: Integer);
procedure DestroyCursors;
function FindMonitor(Handle: HMONITOR): TMonitor;
procedure IconFontChanged(Sender: TObject);
function GetCustomFormCount: Integer;
function GetCustomForms(Index: Integer): TCustomForm;
function GetCursors(Index: Integer): HCURSOR;
function GetDataModule(Index: Integer): TDataModule;
function GetDataModuleCount: Integer;
function GetDefaultIME: String;
function GetDesktopTop: Integer;
function GetDesktopLeft: Integer;
function GetDesktopHeight: Integer;
function GetDesktopWidth: Integer;
function GetDesktopRect: TRect;
function GetWorkAreaRect: TRect;
function GetWorkAreaHeight: Integer;
function GetWorkAreaLeft: Integer;
function GetWorkAreaTop: Integer;
function GetWorkAreaWidth: Integer;
function GetImes: TStrings;
function GetHeight: Integer;
function GetMonitor(Index: Integer): TMonitor;
function GetMonitorCount: Integer;
function GetFonts: TStrings;
function GetForm(Index: Integer): TForm;
function GetFormCount: Integer;
procedure GetMetricSettings;
function GetWidth: Integer;
procedure InsertCursor(Index: Integer; Handle: HCURSOR);
procedure RemoveDataModule(DataModule: TDataModule);
procedure RemoveForm(AForm: TCustomForm);
procedure SetCursors(Index: Integer; Handle: HCURSOR);
procedure SetCursor(Value: TCursor);
procedure SetHintFont(Value: TFont);
procedure SetIconFont(Value: TFont);
procedure SetMenuFont(Value: TFont);
procedure UpdateLastActive;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DisableAlign;
procedure EnableAlign;
function MonitorFromPoint(const Point: TPoint;
MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor;
function MonitorFromRect(const Rect: TRect;
MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor;
function MonitorFromWindow(const Handle: THandle;
MonitorDefault: TMonitorDefaultTo = mdNearest): TMonitor;
procedure Realign;
procedure ResetFonts;
property ActiveControl: TWinControl read FActiveControl;
property ActiveCustomForm: TCustomForm read FActiveCustomForm;
property ActiveForm: TForm read FActiveForm;
property CustomFormCount: Integer read GetCustomFormCount;
property CustomForms[Index: Integer]: TCustomForm read GetCustomForms;
property Cursor: TCursor read FCursor write SetCursor;
property Cursors[Index: Integer]: HCURSOR read GetCursors write SetCursors;
property DataModules[Index: Integer]: TDataModule read GetDataModule;
property DataModuleCount: Integer read GetDataModuleCount;
property MonitorCount: Integer read GetMonitorCount;
property Monitors[Index: Integer]: TMonitor read GetMonitor;
property DesktopRect: TRect read GetDesktopRect;
property DesktopHeight: Integer read GetDesktopHeight;
property DesktopLeft: Integer read GetDesktopLeft;
property DesktopTop: Integer read GetDesktopTop;
property DesktopWidth: Integer read GetDesktopWidth;
property WorkAreaRect: TRect read GetWorkAreaRect;
property WorkAreaHeight: Integer read GetWorkAreaHeight;
property WorkAreaLeft: Integer read GetWorkAreaLeft;
property WorkAreaTop: Integer read GetWorkAreaTop;
property WorkAreaWidth: Integer read GetWorkAreaWidth;
property HintFont: TFont read FHintFont write SetHintFont;
property IconFont: TFont read FIconFont write SetIconFont;
property MenuFont: TFont read FMenuFont write SetMenuFont;
property Fonts: TStrings read GetFonts;
property FormCount: Integer read GetFormCount;
property Forms[Index: Integer]: TForm read GetForm;
property Imes: TStrings read GetImes;
property DefaultIme: string read GetDefaultIme;
property DefaultKbLayout: HKL read FDefaultKbLayout;
property Height: Integer read GetHeight;
property PixelsPerInch: Integer read FPixelsPerInch;
property Width: Integer read GetWidth;
property OnActiveControlChange: TNotifyEvent
read FOnActiveControlChange write FOnActiveControlChange;
property OnActiveFormChange: TNotifyEvent
read FOnActiveFormChange write FOnActiveFormChange;
end;