unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, ExtCtrls, ComCtrls, StdCtrls, XPMan, Buttons;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    re: TRichEdit;
    StatusBar1: TStatusBar;
    ControlBar1: TControlBar;
    Panel1: TPanel;
    Panel2: TPanel;
    od: TOpenDialog;
    sd: TSaveDialog;
    N2: TMenuItem;
    N3: TMenuItem;
    txt1: TMenuItem;
    rtf1: TMenuItem;
    N4: TMenuItem;
    N5: TMenuItem;
    sb1: TSpeedButton;
    sb2: TSpeedButton;
    procedure N2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure sb1Click(Sender: TObject);
    procedure reSelectionChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.N2Click(Sender: TObject);
begin
  if od.Execute
    then re.Lines.LoadFromFile(od.FileName);
end;

procedure TForm1.FormCreate(Sender: TObject);
var dir: string;
begin
  getdir(0,dir);
  od.InitialDir:=dir;
end;

procedure TForm1.sb1Click(Sender: TObject);
begin
  with re.SelAttributes do
  if sb1.Down{=true}
    then Style:=Style+[fsBold]
    else Style:=Style-[fsBold];
end;

procedure TForm1.reSelectionChange(Sender: TObject);
begin
  if fsBold in re.SelAttributes.Style
    then sb1.Down:=true
    else sb1.Down:=false;
end;

end.

//(fsBold, fsItalic, fsUnderline, fsStrikeOut);
