B
baiduan
Unregistered / Unconfirmed
GUEST, unregistred user!
一个组件包含3个元控件,panel ,image,scrollbar
动态生成没有问题,注册后属性看不到,为很么?
unit mp2;
interface
uses StdCtrls, ExtCtrls, Graphics, Classes, Controls, Forms, Types, SysUtils;
type
Tmpanel = class(Tpanel)
private
image1: TImage;
scrollbar1: TScrollBar;
fselectcount:integer;
fupdownwidth:Integer;
fiwidth:integer;
fiheight:integer;
fgapwidth:integer;
fframecount:integer;
ffillrectcolor:Tcolor;
//selectframe:array of array[0..1] of integer;
//fselectarray: array of array of integer;
procedure setnum(const Value: integer);
procedure setiwidth(const Value: integer);
procedure setiheight(const Value: integer);
procedure setgapwidth(const Value: integer);
procedure setfillrectcolor(const Value: tcolor);
procedure setupdownwidth(const Value: Integer);
function getselectcount: Integer;
function getselectunit(index1, index2: integer): Integer;
protected
procedure image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure initrectset(Length: Integer);
function drawbmpheard(mycanvas: TCanvas; myrect: Trect; mark: Integer; iwidth, gapwidth: Integer; x, y: Integer): integer;
procedure refershit(img: Timage; allwidth, iwidth, iheight, gapwidth: integer; x, y: integer);
function drawbmpunit(mycanvas: TCanvas; myrect: Trect; inlinescolor: Tcolor; x, y: integer): Integer;
// procedure drawit(img: Timage; allwidth, iwidth, iheight, gapwidth: integer; x, y: integer);
procedure sclength(l: Integer; oldl: Integer);
procedure multdrawit(img: Timage; allwidth, iwidth, iheight, gapwidth: integer; x, y: integer);
procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
public
property getselect[index1:Integer;index2:integer]:Integer read getselectunit;
property selectcount:Integer read getselectcount;
property updownwidth:Integer read fupdownwidth write setupdownwidth default 2;
property framecount:integer read fframecount write setnum default 1;
property iwidth:integer read fiwidth write setiwidth default 50;
property iheight:integer read fiheight write setiheight default 52; //52:=2+30(heardheight)+2+18(unitheight);
property gapwidth:integer read fgapwidth write setgapwidth default 1;
property fillrectcolor:Tcolor read ffillrectcolor write setfillrectcolor default clGreen;
// property selectframe:array of array[0..1] of integer read fselectarray;
constructor Create(AOwer: TComponent); override;
procedure initdraw;
destructor Destroy;
end;
mrect = packed record
num: integer; //小格子的数目 这个必须复制给scrollbar.max;
iwidth: Integer; //定义小格子的宽度
iheight: integer; //定义小格子的高度
gapwidth: Integer; //小格子的间隙宽度
Singleselect: Boolean; //单选择
multselect: Boolean; //多选择
selectbegin: integer; //选择开始的格子数目
selectend: integer; //选择结束的格子数目
Pos: Integer; //显示的偏移量
updownwidth:integer;//上下间隔
fillrectcolor:integer;//填充颜色
end;
procedure Register;
implementation
动态生成没有问题,注册后属性看不到,为很么?
unit mp2;
interface
uses StdCtrls, ExtCtrls, Graphics, Classes, Controls, Forms, Types, SysUtils;
type
Tmpanel = class(Tpanel)
private
image1: TImage;
scrollbar1: TScrollBar;
fselectcount:integer;
fupdownwidth:Integer;
fiwidth:integer;
fiheight:integer;
fgapwidth:integer;
fframecount:integer;
ffillrectcolor:Tcolor;
//selectframe:array of array[0..1] of integer;
//fselectarray: array of array of integer;
procedure setnum(const Value: integer);
procedure setiwidth(const Value: integer);
procedure setiheight(const Value: integer);
procedure setgapwidth(const Value: integer);
procedure setfillrectcolor(const Value: tcolor);
procedure setupdownwidth(const Value: Integer);
function getselectcount: Integer;
function getselectunit(index1, index2: integer): Integer;
protected
procedure image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure initrectset(Length: Integer);
function drawbmpheard(mycanvas: TCanvas; myrect: Trect; mark: Integer; iwidth, gapwidth: Integer; x, y: Integer): integer;
procedure refershit(img: Timage; allwidth, iwidth, iheight, gapwidth: integer; x, y: integer);
function drawbmpunit(mycanvas: TCanvas; myrect: Trect; inlinescolor: Tcolor; x, y: integer): Integer;
// procedure drawit(img: Timage; allwidth, iwidth, iheight, gapwidth: integer; x, y: integer);
procedure sclength(l: Integer; oldl: Integer);
procedure multdrawit(img: Timage; allwidth, iwidth, iheight, gapwidth: integer; x, y: integer);
procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
public
property getselect[index1:Integer;index2:integer]:Integer read getselectunit;
property selectcount:Integer read getselectcount;
property updownwidth:Integer read fupdownwidth write setupdownwidth default 2;
property framecount:integer read fframecount write setnum default 1;
property iwidth:integer read fiwidth write setiwidth default 50;
property iheight:integer read fiheight write setiheight default 52; //52:=2+30(heardheight)+2+18(unitheight);
property gapwidth:integer read fgapwidth write setgapwidth default 1;
property fillrectcolor:Tcolor read ffillrectcolor write setfillrectcolor default clGreen;
// property selectframe:array of array[0..1] of integer read fselectarray;
constructor Create(AOwer: TComponent); override;
procedure initdraw;
destructor Destroy;
end;
mrect = packed record
num: integer; //小格子的数目 这个必须复制给scrollbar.max;
iwidth: Integer; //定义小格子的宽度
iheight: integer; //定义小格子的高度
gapwidth: Integer; //小格子的间隙宽度
Singleselect: Boolean; //单选择
multselect: Boolean; //多选择
selectbegin: integer; //选择开始的格子数目
selectend: integer; //选择结束的格子数目
Pos: Integer; //显示的偏移量
updownwidth:integer;//上下间隔
fillrectcolor:integer;//填充颜色
end;
procedure Register;
implementation