Q&A

  • MDI PARENT FORM에 배경이미지 삽입
MDI PARENT FORM에 배경이미지를 삽입했는데..

RUN 하면 아무것도 없는것처럼 나옵니다.

이미지는 JPG구여...

조언 부탁드립니다...
2  COMMENTS
  • Profile
    최석기 2002.04.24 02:51
    unit Unit1;

    interface

    uses SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

    type
    TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    private
    { Private declarations }
    FOldDefWndProc : Pointer;
    FNewDefWndProc : Pointer;

    procedure ClientWndProc ( var Msg: TMessage );
    public
    { Public declarations }
    end;

    var Form1: TForm1;

    implementation

    {$R *.DFM}

    procedure TForm1.ClientWndProc;
    var
    ClientDC : HDC;
    MemDC : TBitmap;
    MemDCX : Integer;
    MemDCY : Integer;
    begin
    case Msg.Msg of
    WM_PAINT : begin
    ClientDC := GetDC ( ClientHandle );

    MemDC := TBitmap.Create;
    MemDC.LoadFromFile ( 'C:ATHENA.BMP' );
    MemDCX := 0;
    MemDCY := 0;
    repeat
    repeat
    BitBlt ( ClientDC, MemDCX, MemDCY, MemDC.Width,
    MemDC.Height, MemDC.Canvas.Handle, 0, 0, SRCCOPY );
    Inc ( MemDCX, MemDC.Width );

    until MemDCX >= ClientWidth;
    MemDCX := 0;
    Inc ( MemDCY, MemDC.Height );
    until MemDCY >= ClientHeight;
    ReleaseDC ( ClientHandle, ClientDC );
    MemDC.Free;
    end;
    end;
    with Msg do
    Result := CallWindowProc ( FOldDefWndProc, ClientHandle, Msg, wParam, lParam );
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    FNewDefWndProc := MakeObjectInstance ( ClientWndProc );
    FOldDefWndProc := Pointer(SetWindowLong(ClientHandle,
    GWL_WNDPROC,
    LongInt ( FNewDefWndProc ) ) );
    end;

    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    SetWindowLong (ClientHandle, GWL_WNDPROC, LongInt FOldDefWndProc));
    FreeObjectInstance ( FNewDefWndProc );
    end;

    end.



  • Profile
    한창훈 2002.04.25 04:35
    죄송합니다...
    이대루 해봤는데..계속 에러가 뜨내여..

    혹시 jpg으로 하는 방법은 없을까요?
    그리구 c:에서 읽어오는거 같은데여...혹시 저장해서 쓸수 있는방법은 없을까요?

    조언부탁드립니다.