热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Delphi与DirectX之DelphiX(88):TDIB.DrawQuickAlpha();

本例效果图:代码文件:unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Cont

本例效果图:

Delphi 与 DirectX 之 DelphiX(88): TDIB.DrawQuickAlpha();

代码文件:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    DXPaintBox1: TDXPaintBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

var
  dib: TDIB;

procedure TForm1.FormCreate(Sender: TObject);
begin
  dib := TDIB.Create;
  dib.SetSize(DXPaintBox1.Width, DXPaintBox1.Height, 24);
  dib.Fill(0);
  dib.Canvas.Brush.Style := bsClear;
  dib.Canvas.Font.Color := clRed;
  dib.Canvas.Font.Name := 'Tahoma';
  dib.Canvas.Font.Size := 32;
  dib.Canvas.Font.Style := [fsBold];
  dib.Canvas.TextOut(10, 10, 'DelphiX');
  Self.Color := clWhite;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  dib.Free;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Assign(dib);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clBlack, fmNormal);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clBlack, fmMix75);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clBlack, fmMix50);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clBlack, fmMix25);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clRed, fmNormal);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clRed, fmMix75);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clRed, fmMix50);
  DXPaintBox1.Repaint;
end;

procedure TForm1.Button9Click(Sender: TObject);
begin
  DXPaintBox1.DIB.Fill(Self.Color);
  DXPaintBox1.DIB.DrawQuickAlpha(dib, 0, 0, dib.Width, dib.Height, 0, 0, clRed, fmMix25);
  DXPaintBox1.Repaint;
end;

end.


窗体文件:
object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 224
  ClientWidth = 208
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate= FormCreate
  OnDestroy= FormDestroy
  PixelsPerInch = 96
  TextHeight = 13
  object DXPaintBox1: TDXPaintBox
    Left = 8
    Top = 8
    Width = 193
    Height = 73
    AutoStretch = False
    Center = False
    KeepAspect = False
    Stretch = False
    ViewWidth = 0
    ViewHeight = 0
  end
  object Button1: TButton
    Left = 8
    Top = 92
    Width = 67
    Height = 125
    Caption = 'Button1'
    TabOrder = 0
    OnClick= Button1Click
  end
  object Button2: TButton
    Left = 81
    Top = 92
    Width = 58
    Height = 25
    Caption = 'Button2'
    TabOrder = 1
    OnClick= Button2Click
  end
  object Button3: TButton
    Left = 145
    Top = 92
    Width = 57
    Height = 25
    Caption = 'Button3'
    TabOrder = 2
    OnClick= Button3Click
  end
  object Button4: TButton
    Left = 81
    Top = 123
    Width = 58
    Height = 25
    Caption = 'Button4'
    TabOrder = 3
    OnClick= Button4Click
  end
  object Button5: TButton
    Left = 145
    Top = 123
    Width = 57
    Height = 25
    Caption = 'Button5'
    TabOrder = 4
    OnClick= Button5Click
  end
  object Button6: TButton
    Left = 81
    Top = 161
    Width = 58
    Height = 25
    Caption = 'Button6'
    TabOrder = 5
    OnClick= Button6Click
  end
  object Button7: TButton
    Left = 145
    Top = 161
    Width = 57
    Height = 25
    Caption = 'Button7'
    TabOrder = 6
    OnClick= Button7Click
  end
  object Button8: TButton
    Left = 81
    Top = 192
    Width = 58
    Height = 25
    Caption = 'Button8'
    TabOrder = 7
    OnClick= Button8Click
  end
  object Button9: TButton
    Left = 145
    Top = 192
    Width = 57
    Height = 25
    Caption = 'Button9'
    TabOrder = 8
    OnClick= Button9Click
  end
end


推荐阅读
  • 第一步:PyQt4Designer设计程序界面该部分设计类同VisvalStudio内的设计,改下各部件的objectName!设计 ... [详细]
  • 转载:MFC 获得各类指针、句柄的方法
    2019独角兽企业重金招聘Python工程师标准转载:最近有些人在问MFC编程一些要点,有一些句柄的获取、指针的获取是 ... [详细]
  • C#DataGridView控件中数据导出到Excel方法一:usingSystem;usingSystem.Collections.Generic;usingSys ... [详细]
  • 有没有一种方法可以在不继承UIAlertController的子类或不涉及UIAlertActions的情况下 ... [详细]
  • Go GUIlxn/walk 学习3.菜单栏和工具栏的具体实现
    本文介绍了使用Go语言的GUI库lxn/walk实现菜单栏和工具栏的具体方法,包括消息窗口的产生、文件放置动作响应和提示框的应用。部分代码来自上一篇博客和lxn/walk官方示例。文章提供了学习GUI开发的实际案例和代码示例。 ... [详细]
  • IOS开发之短信发送与拨打电话的方法详解
    本文详细介绍了在IOS开发中实现短信发送和拨打电话的两种方式,一种是使用系统底层发送,虽然无法自定义短信内容和返回原应用,但是简单方便;另一种是使用第三方框架发送,需要导入MessageUI头文件,并遵守MFMessageComposeViewControllerDelegate协议,可以实现自定义短信内容和返回原应用的功能。 ... [详细]
  • vue使用
    关键词: ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • CentOS 6.5安装VMware Tools及共享文件夹显示问题解决方法
    本文介绍了在CentOS 6.5上安装VMware Tools及解决共享文件夹显示问题的方法。包括清空CD/DVD使用的ISO镜像文件、创建挂载目录、改变光驱设备的读写权限等步骤。最后给出了拷贝解压VMware Tools的操作。 ... [详细]
  • 如何在HTML中获取鼠标的当前位置
    本文介绍了在HTML中获取鼠标当前位置的三种方法,分别是相对于屏幕的位置、相对于窗口的位置以及考虑了页面滚动因素的位置。通过这些方法可以准确获取鼠标的坐标信息。 ... [详细]
  • centos安装Mysql的方法及步骤详解
    本文介绍了centos安装Mysql的两种方式:rpm方式和绿色方式安装,详细介绍了安装所需的软件包以及安装过程中的注意事项,包括检查是否安装成功的方法。通过本文,读者可以了解到在centos系统上如何正确安装Mysql。 ... [详细]
  • 本篇文章笔者在上海吃饭的时候突然想到的这段时间就有想写几篇关于返回系统的笔记,所以回家到之后就奋笔疾书的写出来发布了事先在网上找了很多方法,发现有 ... [详细]
  • ExcelApp#启动excel程序ExcelAppCreateOleObject(“Excel.Application”);#加载文件但不显示文件内容(true表 ... [详细]
  • unitUnit1;interfaceusesWinapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,Syst ... [详细]
  • 九、删除用户 并提交代码到git仓库
    (1)弹框询问用户是否删除数据 ... [详细]
author-avatar
后起之秀
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有