Pattern counts and pattern name

Top  Previous  Next

Once you get hold of a rectangular pattern you can count rows and columns as follows...

 

       // Getting hold of the row and column counts is a bit tricky...

       CComVariant varRowCount (pRectPattern->RowCount->GetValue());

       CComVariant varColCount (pRectPattern->ColumnCount->GetValue());

 

       // Getting hold of the pattern name...

       const CString kcsPatternName (pRectPattern->Name.GetBSTR());

       const UINT ikNumSubItems = int(varRowCount.dblVal * varColCount.dblVal);

 

       gLogger.Printf (ekLogMsg,L"Rect Pattern <%s> has %.1f rows and %.1f columns, numsub items=%d",

                       kcsPatternName,varRowCount.dblVal,varColCount.dblVal,ikNumSubItems);

 

Oddly enough the counts are double values, which is why we use .dblVal in the above code.

 

The code also illustrates getting hold of the pattern's name.

 

Patterns can have a count of 1.

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)