Marco's Web Center

Menu for Development

Site Menu
Object Pascal Handbook
Delphi Handbooks Collection
Mastering Borland Delphi 2005
(Old) White Papers
(Old)Tools
(Old) Conferences

My Other Sites
Italian Site (www.marcocantu.it)
the delphi search

Spirit of delphi

Advertising
Home My Blog Books Object Pascal Marco

Home: Code Repository: Mastering Delphi 5

Project ICONS

Project Structure


ICONS.DPR

program Icons;

{%File '..\CLIPBMP\CLIPBMP.DPR'}

uses
  Forms,
  IconsF in 'IconsF.pas' {Form1};

begin
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

CLIPBMP.DPR

program ClipBmp;

uses
  Forms,
  Viewer in 'VIEWER.PAS' {Form1},
  Preview in 'PREVIEW.PAS' {PreviewForm};

{$R *.RES}

begin
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TPreviewForm, PreviewForm);
  Application.Run;
end.

ICONSF.PAS

unit IconsF;

interface

uses
  SysUtils, Windows, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, ExtCtrls, StdCtrls;

              type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Panel1: TPanel;
    Panel2: TPanel;
    Image1: TImage;
    Image2: TImage;
    Button1: TButton;
    Button2: TButton;
    Bevel1: TBevel;
    OpenDialog1: TOpenDialog;
    Button3: TButton;
    Button4: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  with OpenDialog1 do
    if Execute then
    begin
      Application.Icon.LoadFromFile (Filename);
      Image1.Picture.LoadFromFile (Filename);
    end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  with OpenDialog1 do
    if Execute then
    begin
      Icon.LoadFromFile (Filename);
      Image2.Picture.LoadFromFile (Filename);
    end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  Application.Icon := nil;
  Image1.Picture := nil;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  Icon := nil;
  Image2.Picture := nil;
end;

end.

ICONSF.DFM

object Form1: TForm1
  Left = 258
  Top = 178
  Width = 465
  Height = 294
  Caption = 'Icons'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -16
  Font.Name = 'Arial'
  Font.Style = [fsBold]
  Icon.Data = {
    0000010001002020100000000000E80200001600000028000000200000004000
    0000010004000000000080020000000000000000000000000000000000000000
    0000000080000080000000808000800000008000800080800000C0C0C0008080
    80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000999999999900009999999999000000009
    9999999999000999999999990000000999999999999009999999999990000009
    9900000099900999000000999000000999000000999009990000009990000009
    9900000999900999000009999000000999999999990009999999999900000009
    9999999990000999999999900000000999999999900009999999999000000009
    9900000999000999000009990000000999000009990009990000099900000009
    9999999999000999999999990000000999999999900009999999999000000009
    9999999900000999999999000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    000000000000000000000000000000000000000000000000000000000000FFFF
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE007801FE003
    800FE0018007E3F18FC7E3F18FC7E3E18F87E003800FE007801FE007801FE3E3
    8F8FE3E38F8FE003800FE007801FE00F803FFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
  OldCreateOrder = True
  PixelsPerInch = 96
  TextHeight = 19
  object Label1: TLabel
    Left = 64
    Top = 16
    Width = 123
    Height = 19
    Caption = 'Application Icon'
  end
  object Label2: TLabel
    Left = 272
    Top = 16
    Width = 117
    Height = 19
    Caption = 'Main Form Icon'
  end
  object Bevel1: TBevel
    Left = 227
    Top = 0
    Width = 3
    Height = 267
    Style = bsRaised
  end
  object Panel1: TPanel
    Left = 64
    Top = 56
    Width = 121
    Height = 105
    TabOrder = 0
    object Image1: TImage
      Left = 1
      Top = 1
      Width = 119
      Height = 103
      Align = alClient
      Center = True
      Picture.Data = {
        055449636F6E0000010001002020100000000000E80200001600000028000000
        2000000040000000010004000000000080020000000000000000000000000000
        0000000000000000000080000080000000808000800000008000800080800000
        C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000
        FFFFFF0000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        00000000000CCC0000000CCCCCC0000000CCC000000CCC0000000CCCCCC00000
        00CCC0000000CCC00000CCC00CCC00000CCC00000000CCCCCCCCCCC00CCCCCCC
        CCCC00000000CCCCCCCCCCC00CCCCCCCCCCC000000000CCCCCCCCC0000CCCCCC
        CCC0000000000CCC000CCC0000CCC000CCC0000000000CCC000CCC0000CCC000
        CCC00000000000CCC0CCC000000CCC0CCC000000000000CCC0CCC000000CCC0C
        CC000000000000CCC0CCC000000CCC0CCC0000000000000CCCCC00000000CCCC
        C00000000000000CCCCC00000000CCCCC00000000000000CCCCC00000000CCCC
        C000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
        FFFFFFFFE3F81FC7E3F81FC7F1F18F8FF001800FF001800FF803C01FF8E3C71F
        F8E3C71FFC47E23FFC47E23FFC47E23FFE0FF07FFE0FF07FFE0FF07FFFFFFFFF
        FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
        FFFFFFFF}
    end
  end
  object Panel2: TPanel
    Left = 272
    Top = 56
    Width = 121
    Height = 105
    TabOrder = 1
    object Image2: TImage
      Left = 1
      Top = 1
      Width = 119
      Height = 103
      Align = alClient
      Center = True
      Picture.Data = {
        055449636F6E0000010001002020100000000000E80200001600000028000000
        2000000040000000010004000000000080020000000000000000000000000000
        0000000000000000000080000080000000808000800000008000800080800000
        C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000
        FFFFFF0000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000999999999900009999999
        9990000000099999999999000999999999990000000999999999999009999999
        9999900000099900000099900999000000999000000999000000999009990000
        0099900000099900000999900999000009999000000999999999990009999999
        9999000000099999999990000999999999900000000999999999900009999999
        9990000000099900000999000999000009990000000999000009990009990000
        0999000000099999999999000999999999990000000999999999900009999999
        9990000000099999999900000999999999000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        0000000000000000000000000000000000000000000000000000000000000000
        00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
        E007801FE003800FE0018007E3F18FC7E3F18FC7E3E18F87E003800FE007801F
        E007801FE3E38F8FE3E38F8FE003800FE007801FE00F803FFFFFFFFFFFFFFFFF
        FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
        FFFFFFFF}
    end
  end
  object Button1: TButton
    Left = 64
    Top = 176
    Width = 121
    Height = 33
    Caption = 'Change...'
    TabOrder = 2
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 272
    Top = 176
    Width = 121
    Height = 33
    Caption = 'Change...'
    TabOrder = 3
    OnClick = Button2Click
  end
  object Button3: TButton
    Left = 64
    Top = 216
    Width = 121
    Height = 33
    Caption = 'Remove'
    TabOrder = 4
    OnClick = Button3Click
  end
  object Button4: TButton
    Left = 272
    Top = 216
    Width = 121
    Height = 33
    Caption = 'Remove'
    TabOrder = 5
    OnClick = Button4Click
  end
  object OpenDialog1: TOpenDialog
    Filter = 'Icon (*.ico)|*.ico'
    Options = [ofPathMustExist, ofFileMustExist]
    Left = 8
    Top = 8
  end
end