List of predefined DFM routines

Top  Previous  Next

DFM-Translator > Special assignments > List of predefined DFM routines

Delphi2C# provides several predefined methods for converting special assignments in DFM files. These methods are defined in d2c_dfm.cs, which is installed with Delphi2C#.

 

Their names follow the same conventions as user-defined DFM conversion methods.

 

The file DfmRoutines.txt contains the name components of the predefined routines. It is based on the applications that were used to develop and test the DFM translator. You can load this file into a Delphi2C# project from the DFM routines dialog.

 

The following sections show the C# signatures of the predefined methods.

 

1. Assignment methods

 

Assignment methods handle DFM properties that cannot be translated into ordinary C# property assignments.

 

Binary data

 

public static void AssignTIconData(TForm xp, byte[] bytes)

 

public static void AssignTImageListBitmap(TImageList xp, byte[] bytes)

 

public static void AssignTPictureData(TImage pImage, byte[] bytes)

 

public static void AssignTBitmapData(TSpeedButton xp, byte[] bytes)

 

Form properties

 

public static void AssignFormTextHeight(TForm xpForm, int value)

 

public static void AssignFormPixelsPerInch(TForm xpForm, int value)

 

Data-module properties

 

public static void AssignDataModuleHeight(TDataModule xp, int value)

 

public static void AssignDataModulePixelsPerInch(TDataModule xp, int value)

 

public static void AssignDataModuleWidth(TDataModule xp, int value)

 

Indexed grid properties

 

public static void AssignTStringGridColWidths(TStringGrid xp, int value, int index)

 

public static void AssignTStringGridRowHeights(TStringGrid xp, int value, int index)

 

Other control properties

 

public static void AssignControlIsControl(TControl xp, bool value)

 

The following assignments require the component to have a parent. Delphi2C# therefore delays their execution until the parent has been assigned:

 

public static void AssignTRichEditHideSelection(TRichEdit xp, bool value)

 

public static void AssignTColorBoxStyle(TColorBox xp, TSet styles)

 

2. Creation methods

 

Creation methods create child components that cannot be instantiated by an ordinary DFM object assignment.

 

public static TMenuItem CreateTMainMenuTMenuItem(TMainMenu xp)

 

public static TMenuItem CreateTMenuItemTMenuItem(TMenuItem xp)

 

For example, CreateTMainMenuTMenuItem can be implemented as follows:

 

public static TMenuItem CreateTMainMenuTMenuItem(TMainMenu xp)

{

    TMenuItem item = new TMenuItem(xp);

    xp.Items.Add(item);

    return item;

}

 

The method creates a menu item, adds it to the main menu, and returns the new item so that Delphi2C# can assign its remaining properties.

 

3. Collection-item methods

 

Collection-item methods create or retrieve items in collections that cannot be handled by a simple call to Add.

 

public static TFieldDef GetTFieldDefsitem(TFieldDefs xp, int index)

 

For more information about these methods and their naming conventions, see the topic “Collections”.

 

4. Begin and end methods

 

Begin and end methods perform operations that must take place before or after a group of DFM assignments.

 

public static void OnTDataSetBegin(TDataSet xp)

 

public static void OnTDataSetEnd(TDataSet xp)

 

public static void OnTSplitterBegin(TSplitter xp)

 

public static void OnTSplitterEnd(TSplitter xp)

 

For example, the dataset methods can temporarily deactivate a dataset before its properties are assigned and restore its state afterwards.

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content