To achieve that, we add the following code to the grid's Init method: In order to draw attention to out-of-stock items, we want to show the names of these items in red.įigure 1: This grid shows out-of-stock items in red. The grid in Figure 1 shows stock levels for a products table. To see how these properties work, let's look at the above examples in more detail. Each of these properties controls a particular type of formatting, as indicated by its name.ĭynamicAlignmentDynamicFontItalicDynamicFontSizeĭynamicBackColorDynamicFontNameDynamicFontStrikeThruĭynamicCurrentControlDynamicFontOutlineDynamicFontUnderlineĭynamicFontBoldDynamicFontShadowDynamicForeColor Examples include DynamicFontBold and DynamicForeColor. The key to conditional formatting in VFP grids is a group of properties whose names begin with the word "Dynamic".
Show an image in each row, with different images for different types of records. Make the grid easier to read by shading alternate rows.
Highlight exceptional data in some way, such as showing overdue invoices in bold or out-of-stock items in red. Here are some examples of things you can do with conditional formatting: Put simply, conditional formatting lets you change the appearance or behavior of individual cells - or entire rows - in the grid according to conditions in the underlying data. If you work with grids in Visual FoxPro, you will sooner or later need conditional formatting.
#CONDITIONAL FORMATTING EXCEL 2016 ALTERNATE ROW COLOR HOW TO#
How to apply formatting to some of the cells or rows in a VFP grid but not to others. Conditional formatting in a Visual FoxPro grid