Hallo,
I have started a more complex program, and i would like some guidance.
I have a array of word, and i need to display its contents in a chart.
I had been dooing some testing and here is what i came up to:
on myform i create a scrollbar named sb
on myform i create a Timage named img
on img i create and load a bitmap named bm
and i browse the array up and down with the following code:
Code:
procedure TForm1.sbChange(Sender: TObject);
var increment,i,myData,addrIncrement:integer;
begin
increment:=0;
bm.Canvas.MoveTo(0,327);
clearbm; //i clear bitmap to base color.
bm.Canvas.Font.Color:=clWhite;
bm.Canvas.Font.Size:=8;
for i := sb.Position to sb.Position+700 do
begin
inc(increment,1);
inc(addrIncrement,50);
if oData[i] >= 32769 then
myData:=oData[i] div 2
else
myData:=oData[i];
myData:=327-(myData div 100);
bm.Canvas.Pen.Color:=clWhite;
bm.Canvas.lineTo(increment,myData);
bm.Canvas.TextOut(AddrIncrement-50,329,inttohex((i+50)*2,6));
bm.Canvas.MoveTo(increment,myData);
end;
bm.Canvas.MoveTo(0,329);
bm.Canvas.pen.Color:=$A0A0A0;
bm.Canvas.lineTo(1024,329);
pb.canvas.draw(0,0,bm);
end;
The output looks like file in attach.
All this works but i have some problem:
1. After i minimize the form them i restore it back the bitmap is cleared.
2. somehow i need to able to make a selection on that chart from point A to point B, and to have a vertical cursor so i can move it around the chart.
3. I need to draw vertical and horizontal grids on that chart.
This is my first interactive GUI programing , so i need for someone to tell me the method in how this GUI's are programmed. Thanks!!!