unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, StdCtrls, ExtDlgs, Shellapi, ExtCtrls, jpeg, pngimage, GIFImg;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    Plik1: TMenuItem;
    Czytajtekstowy1: TMenuItem;
    Czytajobraz1: TMenuItem;
    Rne1: TMenuItem;
    Zmianakoloruformularza1: TMenuItem;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    Prostokt1: TMenuItem;
    Elipsa1: TMenuItem;
    Koo1: TMenuItem;
    Nowyformularz1: TMenuItem;
    Koniec1: TMenuItem;
    Opcjabezpolece1: TMenuItem;
    Zapisztekstowy1: TMenuItem;
    Napis11: TMenuItem;
    Napis21: TMenuItem;
    Zmianaczcionki1: TMenuItem;
    Napis12: TMenuItem;
    Napis22: TMenuItem;
    Kalkulator1: TMenuItem;
    SaveDialog1: TSaveDialog;
    Memo1: TMemo;
    FontDialog1: TFontDialog;
    ColorDialog1: TColorDialog;
    Label1: TLabel;
    Label2: TLabel;
    OpenDialog1: TOpenDialog;
    OpenPictureDialog1: TOpenPictureDialog;
    Image1: TImage;
    Shape1: TShape;
    Shape2: TShape;
    Shape3: TShape;
    procedure Koo1Click(Sender: TObject);
    procedure Elipsa1Click(Sender: TObject);
    procedure Prostokt1Click(Sender: TObject);
    procedure Napis21Click(Sender: TObject);
    procedure Napis11Click(Sender: TObject);
    procedure Czytajobraz1Click(Sender: TObject);
    procedure Koniec1Click(Sender: TObject);
    procedure Zapisztekstowy1Click(Sender: TObject);
    procedure Napis12Click(Sender: TObject);
    procedure Kalkulator1Click(Sender: TObject);
    procedure Czytajtekstowy1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Koniec1Click(Sender: TObject);
begin
  Close
end;

procedure TForm1.Koo1Click(Sender: TObject);
begin
 if Koo1.Checked then Shape3.Visible:=true
  else Shape3.Visible:=false;
end;

//ustaw DefaultExt na txt
//opcje Options ofOverwritePrompt na true
procedure TForm1.Zapisztekstowy1Click(Sender: TObject);
begin
  if Savedialog1.Execute then Memo1.Lines.SaveToFile(Savedialog1.FileName);
end;

procedure TForm1.Napis11Click(Sender: TObject);
begin
  Label1.Caption:='Polecenie menu napis1';
end;

procedure TForm1.Napis12Click(Sender: TObject);
begin
 if FontDialog1.Execute then    Label1.Font:=FontDialog1.Font
  else ShowMessage('Nie wybrano nowej czcionki!');

end;

procedure TForm1.Napis21Click(Sender: TObject);
begin
  Label2.Caption:='Polecenie menu napis2';
end;

procedure TForm1.Prostokt1Click(Sender: TObject);
begin
  if Prostokt1.Checked then Shape1.Visible:=true
  else Shape1.Visible:=false;

end;

procedure TForm1.Kalkulator1Click(Sender: TObject);
begin
  //uruchomienie kalkulatora systemowego
  ShellExecute(0,'open','calc.exe',nil,nil,sw_ShowNormal);

end;

procedure TForm1.Czytajobraz1Click(Sender: TObject);
begin
  if OpenPictureDialog1.Execute then Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;

procedure TForm1.Czytajtekstowy1Click(Sender: TObject);
begin
  Opendialog1.InitialDir:=GetCurrentDir;
  if Opendialog1.Execute then Memo1.Lines.LoadFromFile(Opendialog1.FileName);
end;

procedure TForm1.Elipsa1Click(Sender: TObject);
begin
if Elipsa1.Checked then Shape2.Visible:=true
  else Shape2.Visible:=false;
end;

end.
