Aligning the Edges of Controls

The following two code examples show how to use constraints to match the edge of one control to that of another. You specify the second control by its identifier. The second code example shows how to display a status line, for example, “Elapsed: 01:14:23”, consisting of two labels that use different fonts and colors.

   CONTROL "A", IDC_CTRL_A,...
   
   CONTROL         "Same Top As A",
   IDC_CTRL_B,"APC_Label",ASFC_ALIGN_LEFT|ASFC_ALIGN_SINGLELINE,
   0,0,0,0
   BEGIN
      // Use the following constraints to center control B
      // horizontally, with the same vertical position as control A.
      FA_HORIZONTAL_CENTER, FA_TOP_CONTROL,  IDC_CTRL_A
   END

   CONTROL "Elapsed:", IDC_CTRL_ELAPSED,"APC_Label",
      ASFC_ALIGN_LEFT|ASFC_ALIGN_SINGLELINE
   BEGIN
      FA_LEFT_OF_FORM, FA_HORIZONTAL_CENTER
      // Set the font of the control.
      ASFC_DISPID_FONT, L"Tahoma-Bold-18\0"
   END
   CONTROL         "",
   IDC_CTRL_TIME,"APC_Label",ASFC_ALIGN_LEFT|ASFC_ALIGN_SINGLELINE, 
   0,0,0,0
   BEGIN
      FA_LEFT_TO_RIGHT_OF_CONTROL, IDC_CTRL_ELAPSED
   END

// The labels are aligned by setting the left edge of the
// IDC_CTRL_TIME label to the right edge of the IDC_CTRL_ELAPSED label.