SetPrimary method

Sets or unsets this control element as the primary element in a control selection.


HRESULT retVal = object.SetPrimary(fPrimary);


  • fPrimary [in]
    Type: BOOL

    BOOL that specifies TRUE to set the element as the primary element, or FALSE to unset it as primary.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


The primary element of a multiple selection is typically the first one a user chose when making the selection. The primary element typically has distinctive handles that indicate it is the primary element (for example, it might have white handles while all the other selected elements have black ones).

You might, for example, use the primary element as the reference point for an aligning operation.

When you unset the primary element of a selection, there will be no primary element until you explicitly set another one as the primary element.