record的變量如何賦值? (30分)

  • 主题发起人 主题发起人 leway
  • 开始时间 开始时间
L

leway

Unregistered / Unconfirmed
GUEST, unregistred user!
type
RECT = Record
Left: Word;
Top: Word;
Width: Word;
Height: Word;
end;
TBULGEREC = record
wType: WORD;
wWidth: WORD;
wGap: WORD;
wArc: WORD;
wLeftArc: WORD;
wRightArc: WORD;
end;
TPLANREC = record
wType: WORD;
nX1: SmallInt
// X of upper-left corner
nY1: SmallInt
// Y of upper-left corner
wWidth: WORD;
wHigh: WORD;
end;
TPLANARY = array of TPLANREC;
THEAVEREC = record
rectHeave: RECT
// Draw area in the window
bulgeUp: TBULGEREC
// Style of up line
bulgeDown: TBULGEREC
// Style of down line
nColor: SmallInt;
wplans: WORD
// Number of plan
aryPlan: TPLANARY
// Plan data
end;
THEAVEARY = array of THEAVEREC;

{==============================================================================+
| Constant |
+==============================================================================}
const
CNST_SKIN1: array[1..1] of THEAVEREC = ;
 
CNST_SKIN1.bulgeUp.wType:=1
????
 
app2001:
這樣寫麻煩。???
 
咋个麻烦法哦??
 
type
RECT = Record
Left: Word;
Top: Word;
Width: Word;
Height: Word;
end;

TBULGEREC = record
wType: WORD;
wWidth: WORD;
wGap: WORD;
wArc: WORD;
wLeftArc: WORD;
wRightArc: WORD;
end;
TPLANREC = record
wType: WORD;
nX1: SmallInt
// X of upper-left corner
nY1: SmallInt
// Y of upper-left corner
wWidth: WORD;
wHigh: WORD;
end;
TPLANARY = array of TPLANREC;
THEAVEREC = record
rectHeave: RECT
// Draw area in the window
bulgeUp: TBULGEREC
// Style of up line
bulgeDown: TBULGEREC
// Style of down line
nColor: SmallInt;
wplans: WORD
// Number of plan
aryPlan: array [1..1] of TPLANREC
// TPLANARY
// Plan data
end;
THEAVEARY = array of THEAVEREC;

{==============================================================================+
| Constant |
+==============================================================================}
const
CNST_SKIN1: array[1..1] of THEAVEREC = ((
rectHeave:(Left:0;Top:0;Width:0;Height:0);
bulgeUp:(wType:0;wWidth:0;wGap:0;wArc:0;wLeftArc:0;wRightArc:0);
bulgeDown:(wType:0;wWidth:0;wGap:0;wArc:0;wLeftArc:0;wRightArc:0);
nColor:255;
wplans:255;
aryPlan:((wType:1;nX1:2;nY1:3;wWidth:4;wHigh:4))
));
var s:THEAVEREC ;
g:THEAVEARY ;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
s.bulgeUp.wType:=1;
s.bulgeDown.wArc :=100;
setlength(g,10);
g[3].aryPlan[1].wType :=0;
.............................

const 后为只读,不能改动


 


var
SKIN1: array[1..1] of THEAVEREC
又怎樣賦值。
 
setlength(skin1,1);//设置数组长度
with skin1[0] do
begin
rectHeave.left:=0;
bulgeUp.wType:=1;
.....
end;
 
一般初始化或者将一个结构变量赋给另一个结构变量有简便写法: fillchar 和 move
 
多人接受答案了。
 
后退
顶部