Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Возведение матрицы в степень / UShow
.pas unit UShow;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, UMatr;
type
TShow_F = class(TForm)
DrawGrid1: TDrawGrid;
procedure DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
private
{ Private declarations }
public
{ Public declarations }
A_:Matr;
procedure Load(Const a:matr; Const N : Ind_m);
end;
var
Show_F: TShow_F;
implementation
{$R *.dfm}
Procedure TShow_F.Load(Const A : Matr; Const N : Ind_M);
Begin
A_ := A;
DrawGrid1.RowCount := N + 1;
DrawGrid1.ColCount := N + 1;
End;
procedure TShow_F.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
Var S :String;
P, Q : UMatr.Next;
begin
S := '0';
DrawGrid1.Canvas.Font.Color := ClBlack;
If ARow = 0 then Begin
S := IntToStr(ACol);
End;
If ACol = 0 then Begin
S := IntToStr(ARow);
End;
With DrawGrid1.Canvas do Begin
If (ACol <> 0) And (ARow <> 0) then
Begin
Font.Color := ClRed;
P := A_.BaseRow[ARow-1].Right;
Q := P;
While Q^.Col <> 0 do
Begin
If Q^.Col = ACol then
Begin
S := IntToStr(Q^.Val);
Font.Color := ClGreen;
End;
Q := Q.Right;
End;
End;
TextOut(Rect.Left + 10, Rect.Top + 10, S);
End;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, UMatr;
type
TShow_F = class(TForm)
DrawGrid1: TDrawGrid;
procedure DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
private
{ Private declarations }
public
{ Public declarations }
A_:Matr;
procedure Load(Const a:matr; Const N : Ind_m);
end;
var
Show_F: TShow_F;
implementation
{$R *.dfm}
Procedure TShow_F.Load(Const A : Matr; Const N : Ind_M);
Begin
A_ := A;
DrawGrid1.RowCount := N + 1;
DrawGrid1.ColCount := N + 1;
End;
procedure TShow_F.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
Var S :String;
P, Q : UMatr.Next;
begin
S := '0';
DrawGrid1.Canvas.Font.Color := ClBlack;
If ARow = 0 then Begin
S := IntToStr(ACol);
End;
If ACol = 0 then Begin
S := IntToStr(ARow);
End;
With DrawGrid1.Canvas do Begin
If (ACol <> 0) And (ARow <> 0) then
Begin
Font.Color := ClRed;
P := A_.BaseRow[ARow-1].Right;
Q := P;
While Q^.Col <> 0 do
Begin
If Q^.Col = ACol then
Begin
S := IntToStr(Q^.Val);
Font.Color := ClGreen;
End;
Q := Q.Right;
End;
End;
TextOut(Rect.Left + 10, Rect.Top + 10, S);
End;
end;
end.