zoukankan      html  css  js  c++  java
  • SetWindowLong 给MDI窗体加背景

    //给MDI窗体加背景 
    //设置Form1窗体的FormStyle属性为fsMDIForm
    //设置Form2窗体的FormStyle属性为fsMDIChild

    // Image控件 Bmp格式图片

      private
          FClientInstance : TFarProc;
          FPrevClientProc : TFarProc;
          Procedure ClientWndProc(Var Message: TMessage);

    procedure TForm1.ClientWndProc(var Message: TMessage);
    var
          Dc : hDC;
          Row : Integer;
          Col : Integer;
    begin
      with Message do
        case Msg of
        WM_ERASEBKGND://当要重会背景时
        begin
          Dc := TWMEraseBkGnd(Message).Dc;
          // 铺图象
          //计算并会制行和高总共要画的数量。
          for Row := 0 to ClientHeight div Image1.Picture.Height do
            for Col := 0 to ClientWidth div Image1.Picture.Width do
              BitBlt(Dc,Col * Image1.Picture.Width,Row * Image1.Picture.Height
                     ,Image1.Picture.Width,Image1.Picture.Height
                     ,Image1.Picture.Bitmap.Canvas.Handle,0,0,SRCCOPY);
          Result := 1;
          end;
        else // 传递其他消息
          Result := CallWindowProc(FPrevClientProc,ClientHandle,Msg,wParam,lParam);
      end;
    end;
    procedure TForm1.FormShow(Sender: TObject);
    begin
      FClientInstance := MakeObjectInstance(ClientWndProc);//将自定义过程的地址入口存入PClientInstance中
      FPrevClientProc := Pointer(GetWindowLong(ClientHandle,GWL_WNDPROC));//记录消息位置
      SetWindowLong(ClientHandle,GWL_WNDPROC,LongInt(FClientInstance));//重新载入窗口的消息并继续处理。
    end;

    //为非MDI窗体制作背景




  • 相关阅读:
    2018 ICPC 徐州网络赛
    2018 CCPC网络赛
    2013 NEERC
    2015 Dhaka
    2018ICPC南京网络赛
    Codeforces Round #505
    Codeforces Round #504 E. Down or Right
    Codeforces Round #504 D. Array Restoration
    2018 Multi-University Training Contest 3
    2018 Multi-University Training Contest 2
  • 原文地址:https://www.cnblogs.com/xe2011/p/2531617.html
Copyright © 2011-2022 走看看