⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 delphi编程实效百例的随书源代码 这是其中的界面外观部分
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    SpeedButton1: TSpeedButton;
    BitBtn1: TBitBtn;
    OpenDialog1: TOpenDialog;
    ColorDialog1: TColorDialog;
    procedure Button1Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
var
  TranColor:tcolor;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  ColorDialog1.Color:=TranColor;
  If ColorDialog1.Execute then
    TranColor:=ColorDialog1.Color;
    //选择要透明的颜色
end;



procedure TForm1.BitBtn1Click(Sender: TObject);
var
  Bitmap:TBitMap;
begin
  Bitmap:=TBitmap.Create;
  If OpenDialog1.Execute then
  begin
    try
      with Bitmap do begin
        LoadFromFile(OpenDialog1.FileName);
        //选择要透明的图片
        Form1.Canvas.Draw(0,0,BitMap);
        //显示未透明的图片
        Transparent:=True;
        TransParentColor:=TranColor;
        //设定透明色
        Form1.Canvas.Draw(280,0,BitMap);
        //显示已透明图片
      end;
    finally
    Bitmap.Free;
    end;
  end;
end;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -