IMinutesField.SetFormatting (EstimateColumnsView, IColumnFormatting) Method

Sets the column formatting of the field for the current user. The formatting is user specific. It describes how the field is displayed in a specific view.
Sub SetFormatting( _ 
ByVal view As EstimateColumnsView, _ 
ByVal formatting As IColumnFormatting
)
This language is not supported or no code example is available.
void SetFormatting( 
EstimateColumnsView view
IColumnFormatting formatting 
)
This language is not supported or no code example is available.

Parameters

view
EstimateColumnsView

The view for which the formatting should be set. The minutes fields may be displayed in different views and the field formatting may be different for each view.

formatting
IColumnFormatting

The column formatting to be applied to the field. You can call GetFormatting method to get an instance of IColumnFormatting.

Exception type Condition

ArgumentOutOfRangeException

The view argument was set to EstimateColumnsView.General. This value is deprecated and doesn't refer to any particular view and thus cannot be used in this context.

Remarks
 

This method applies the changes immediately. So unlike when you set the properties, after you call this method, you don't need to call IMinutesFieldManager.ApplyChanges afterwards. But you still need to call IEstimate.CheckAndRepaint to repaint the applied changes.

Not all properties of the formatting are supported in minutes fields. For example, IColumnFormatting.Header1Formatting and IColumnFormatting.Header2Formatting cannot be customized. Such properties are ignored.

Additionally, the IColumnFormatting.ColumnPosition property is ignored as well. This method will not change the column position. This is to prevent possible conflicts or invalid positions. If you want to change the position of the column, use IMinutesFieldManager.MakeFieldsVisible method.

Example
 

The following example demonstrates how to change the background color of "Unit" field and move it before "Description" field.

// Get Unit field.
 IMinutesFieldManager minFieldsmanager = es.GetMinutesFieldManager();
 IMinutesField field = minFieldsmanager.GetField("Unit");
 
 // Change its background color.
 IColumnFormatting format = field.GetFormatting(EstimateColumnsView.Minutes);
 format.DataFormatting.BackgroundColor = System.Drawing.Color.Red;
 field.SetFormatting(EstimateColumnsView.Minutes, format);
 
 // Change the position. This cannot be done with IMinutesField.SetFormatting().
 // It must be done with MakeFieldsVisible, but the field must be made hidden first.
 var fields = new List<string>() { "Unit" };
 minFieldsmanager.MakeFieldsInvisible(fields, EstimateColumnsView.Minutes, FieldUserScope.ThisUser);
 minFieldsmanager.MakeFieldsVisible(fields, EstimateColumnsView.Minutes, FieldUserScope.ThisUser,
  FieldPlacementPosition.BeforeGivenField, "Description");
 
 // Repaint the changes
 es.RepaintCurrentView();					
This language is not supported or no code example is available.

Version
 
Available since QDV 7.22.966.

.NET Framework

Supported in: 4.8, 4.7, 4.6, 4.5.2

In this article

Definition