• Delphi在Webbrowser上绘制图像


    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, OleCtrls, IEBrowser;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        CppWebBrowser1: TCppWebBrowser;
        procedure FormCreate(Sender: TObject);
        procedure FormShow(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
        OldMessage: TWndMethod;
        procedure OleMessage(var Msg: TMessage);
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      CppWebBrowser1.Navigate('www.baidu.com');
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      //WebBrowser1.Navigate('www.baidu.com');
    end;
    
    procedure TForm1.FormShow(Sender: TObject);
    begin
      OldMessage := CppWebBrowser1.WindowProc;
      CppWebBrowser1.WindowProc := OleMessage;
    end;
    
    procedure TForm1.OleMessage(var Msg: TMessage);
    var
      c: TCanvas;
      bmpBG: TBitmap;
    begin
      OldMessage(Msg);
      if Msg.Msg=WM_PAINT then
      begin
        bmpBG := TBitmap.Create;
        bmpBG.Transparent := true;
        bmpBG.LoadFromFile(ExtractFilePath(Application.ExeName) + 'back.bmp');
        c := TControlCanvas.Create;
        TControlCanvas(c).Control := CppWebBrowser1;
        c.Brush.Style := bsClear;
        c.StretchDraw(c.ClipRect, bmpBG);
      end;
    end;
    
    end.

    http://www.lsworks.net/article/100.html

  • 相关阅读:
    第13章 子查询和集合运算
    第12章 SQL联接
    第11章 分组函数 ​
    第10章 单行函数 ​
    第15章 RMAN备份 ​
    第1章
    OCP/OCA Oracle 学习001
    Linq之Sum用法新体会
    java中的异常
    android SQLite使用SQLiteOpenHelper类对数据库进行操作
  • 原文地址:https://www.cnblogs.com/findumars/p/4998870.html
Copyright © 2020-2023  润新知