canvas教程

delphi 画图示例源码(LiveBinding)

字号+ 作者:H5之家 来源:H5之家 2018-03-29 16:00 我要评论( )

实例介绍 【实例简介】 【实例截图】 【核心代码】 unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.stdCtrls,Vcl.ExtCtrls, Data

实例介绍

【实例简介】

【实例截图】

from clipboard


from clipboard


【核心代码】

unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.stdCtrls,Vcl.ExtCtrls, Data.Bind.EngExt, Vcl.Bind.DBEngExt, System.Rtti, System.Bindings.Outputs, Vcl.Bind.Editors, Data.Bind.Components; type TMain = class(TForm) Button1: TButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; edtTop: TEdit; edtLeft: TEdit; edtWidth: TEdit; edtHeight: TEdit; Panel1: TPanel; Image1: TImage; BindingsList1: TBindingsList; LinkControlToPropertyTop: TLinkControlToProperty; LinkControlToPropertyLeft: TLinkControlToProperty; LinkControlToPropertyHeight: TLinkControlToProperty; LinkControlToPropertyWidth: TLinkControlToProperty; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } procedure RedrawImage; end; var Main: TMain; implementation {$R *.dfm} procedure TMain.Button1Click(Sender: TObject); begin RedrawImage; end; procedure TMain.FormCreate(Sender: TObject); begin RedrawImage; end; procedure TMain.RedrawImage; var I, J: Integer; Bitmap: TBitmap; begin { create a bitmap picture in the memory } Bitmap := TBitmap.Create; { use the dimensions of the Image1 control } Bitmap.Width := Image1.Width; Bitmap.Height := Image1.Height; { dynamically render a color spectrum } for I := 0 to Bitmap.Width do for J := 0 to Bitmap.Height do Bitmap.Canvas.Pixels[I, J] := RGB(I, J, 128); { assign the bitmap to Image1 } Image1.Picture.Bitmap := Bitmap; { free up used memory } Bitmap.Free; end; end.

标签: livebinding

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • html Canvas 画图 能够选择并能移动

    html Canvas 画图 能够选择并能移动

    2018-03-29 15:04

  • HTML5学习笔记(一)canvas画图

    HTML5学习笔记(一)canvas画图

    2018-03-12 17:01

  • canvas HTML5 新标签 介绍怎么使用 画图作画 WEB(ASP,PHP,...) 2

    canvas HTML5 新标签 介绍怎么使用 画图作画 WEB(ASP,PHP,...) 2

    2018-03-12 09:06

  • HTML5通过挪用canvas工具的getContext()要领来获取画图情形

    HTML5通过挪用canvas工具的getContext()要领来获取画图情形

    2018-03-11 15:02

网友点评
n