хочу сделать заставку для нее. сделал вторую форму.пишу
- Код: Выделить всё
fLogo.Show;
ПРОЕКТ ВЫЗВАЛ ИСКЛЮЧЕНИЕ КЛАССА EXTERNAL SIGSEGV ПО АДРЕСУ 419981
ЗАКОМЕНТИРОВАЛ
- Код: Выделить всё
//fLogo.Show;
спасибо
Модератор: Модераторы
fLogo.Show;
//fLogo.Show;
unit uMain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
ComCtrls, uLogo;
type
{ TfMain }
TfMain = class(TForm)
MainMenu1: TMainMenu;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
fMain: TfMain;
implementation
{$R *.lfm}
{ TfMain }
procedure TfMain.FormCreate(Sender: TObject);
begin
fLogo.Show;
end;
end.
unit uLogo;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls;
type
{ TfLogo }
TfLogo = class(TForm)
Image1: TImage;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure ImShow(x,y:integer);
private
{ private declarations }
public
{ public declarations }
end;
var
fLogo: TfLogo;
implementation
{$R *.lfm}
{ TfLogo }
procedure TfLogo.ImShow(x,y:integer);
var i:integer;
begin
end;
procedure TfLogo.Timer1Timer(Sender: TObject);
var i:integer;
begin
close;
end;
end.
procedure TForm1.FormCreate(Sender: TObject);
begin
application.CreateForm(TForm2, form2);
form2.show;
end;
application.CreateForm(TfLogo,fLogo);
application.Run;
fLogo.Show;
form1.SetFocus
Application.Initialize;
fmSplash := TfmSplash.Create(nil);
...
procedure TForm1.FormCreate(Sender: TObject);
begin
fmSplash.Show; //окно отображается немодальным
fmSplash.Repaint; //метод, заставляющий осуществить
//перерисовку формы
Sleep(3000); //задержка заставки на 3 сек
fmSplash.Hide; //метод, делающий форму невидимой
//можно было fmSplash.Close
fmSplash.Free; //освобождение памяти
...
unit uLogo;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
ComCtrls, StdCtrls;
type
{ TfLogo }
TfLogo = class(TForm)
Image1: TImage;
Label1: TLabel;
Timer1: TTimer;
Timer2: TTimer;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
fLogo: TfLogo;
fgx,fgy:array [1..8] of integer;
xi,yj:integer;
implementation
uses uMain;
{$R *.lfm}
procedure triangle(x0,y0,x1,y1,x2,y2:integer);
begin
with fLogo.Image1.Canvas do begin
MoveTo(x0,y0);
LineTo(x1,y1);
LineTo(x2,y2);
LineTo(x0,y0);
end;
end;
procedure line(x0,y0,x1,y1:integer);
begin
with fLogo.Image1.Canvas do begin
Pen.Color:=clRed;
Pen.Width:=2;
MoveTo(x0,y0);
LineTo(x1,y1);
end;
end;
{ TfLogo }
procedure TfLogo.Timer1Timer(Sender: TObject);
begin
if xi=5 then begin
line(fgx[5],fgy[2],fgx[4],fgy[1]);
dec(xi);
end else begin
line(fgx[xi],fgy[yj],fgx[xi-1],fgy[yj]);
dec(xi);
if xi=2 then begin
line(fgx[2],fgy[1],fgx[1],fgy[2]);
dec(xi); yj:=3;
Timer2.Enabled:=true; Timer1.Enabled:=false; exit;
end;
end;
{ line(260,85,210,35);
line(210,35,160,35);
line(160,35,110,35);
line(110,35,60,85);
line(60,85,110,135);
line(110,135,160,135);
line(160,135,210,135);
line(210,135,260,85); }
end;
procedure TfLogo.Timer2Timer(Sender: TObject);
begin
if xi=1 then begin
line(fgx[1],fgy[2],fgx[2],fgy[3]);
inc(xi);
end else begin
line(fgx[xi],fgy[yj],fgx[xi+1],fgy[yj]);
inc(xi);
if xi=4 then line(fgx[4],fgy[3],fgx[5],fgy[2]);
if xi=5 then close;
end;
end;
procedure TfLogo.FormCreate(Sender: TObject);
var i:integer;
begin
xi:=5; yj:=1;
for i:=1 to 5 do
fgx[I]:=10+50*I;
for i:=1 to 3 do
fgy[I]:=35+50*(I-1);
image1.Canvas.Brush.Color:=clwhite;
image1.Canvas.Rectangle(0,0,fLogo.width,fLogo.height);
triangle(110,110,160,60,210,110);
end;
procedure TfLogo.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction:=caFree;
fMAIN.SetFocus;
end;
end.
unit uMain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
ComCtrls, uLogo;
type
{ TfMain }
TfMain = class(TForm)
MainMenu1: TMainMenu;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
fMain: TfMain;
implementation
{$R *.lfm}
{ TfMain }
procedure TfMain.FormCreate(Sender: TObject);
begin
Application.CreateForm(TfLogo, fLogo);
Application.Run;
fLogo.Show;
end;
end.
program CircuitBuilder;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, uMain, uLogo;
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TfMain, fMain);
Application.Run;
end.
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 239