home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
- PRODUCT : Delphi NUMBER : 2812
- VERSION : All
- OS : Windows
- DATE : July 14, 1995 PAGE : 1/1
-
- TITLE : Control Font Styles
-
-
-
-
- Control Font Styles:
-
- This code will change the font style of a Edit
- when selected. This code could be implemented to
- control font style on other objects.
-
- With a Edit(Edit1) and a ListBox(ListBox1) on a form
- Add the following Items to the ListBox:
- fsBold
- fsItalic
- fsUnderLine
- fsStrikeOut
-
- procedure TForm1.ListBox1Click(Sender: TObject);
- var
- X : Integer;
- type
- TLookUpRec = record
- Name: String;
- Data: TFontStyle;
- end;
- const
- LookUpTable: array[1..4] of TLookUpRec =
- ((Name: 'fsBold'; Data: fsBold),
- (Name: 'fsItalic'; Data: fsItalic),
- (Name: 'fsUnderline'; Data: fsUnderline),
- (Name: 'fsStrikeOut'; Data: fsStrikeOut));
- begin
- X := ListBox1.ItemIndex;
- Edit1.Text := ListBox1.Items[X];
- Edit1.Font.Style := [LookUpTable[ListBox1.ItemIndex+1].Data];
- end;
-
-
-
-
-
-
-
-
- DISCLAIMER: You have the right to use this technical information
- subject to the terms of the No-Nonsense License Statement that
- you received with the Borland product to which this information
- pertains.
-