IMinutesField.SetFormatting (EstimateColumnsView, IColumnFormatting, FieldUserScope) Method
Sub SetFormatting( _
ByVal view As EstimateColumnsView, _
ByVal formatting As IColumnFormatting, _
ByVal forUsers As FieldUserScope _
)
This language is not supported or no code example is available.
void SetFormatting(
EstimateColumnsView view,
IColumnFormatting formatting,
FieldUserScope forUsers
)
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.
- forUsers
- FieldUserScope
The users this operation will be applied to.
Exception type | Condition |
---|---|
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. |
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.
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.