Link to home
Start Free TrialLog in
Avatar of OutsideTheBox
OutsideTheBox

asked on

proper syntax??

What is the proper syntax to use here?
How do I inject integers row & col into my statement to direct the code to increment which matrix variable it needs to display? (eg. myMatrix.M11, myMatrix.M12, myMatrix.M13, etc are fields within myMatrix)


            for (int row = 1; i < 5; row++)
            {
               
                for (int col = 1; j < 5; col++)
                {
                    frameFont.DrawText(null, Convert.ToInt16(MyMatrix.M    row???    col???     ).ToString(), new Point(mStartHortz,mStartVert), Color.White);
                    mStartHortz += spH;
                }
                mStartVert += spV;
            }
Thanks, Steve
ASKER CERTIFIED SOLUTION
Avatar of dstanley9
dstanley9

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of OutsideTheBox
OutsideTheBox

ASKER

Thanks,
there are 4 rows and 4 columns.

I can do it the long way I thought one statement would be clean. It is just for troubleshooting anyway, not for anything to be used.

No, not mine, it is a Microsoft class; Microsoft.Directx.Matrix
Programming with C++ using different DirectX classes it  uses indexers (Matrix[][]) but in managed DirectX they do not.

Thank you,
Steve
frameFont.DrawText(null, Convert.ToInt16(MyMatrix.M[i][j]).ToString(), new Point(mStartHortz,mStartVert), Color.White);


dZ..,                  
Boy, talk about the ultimate in bounds-checking!  They must have done it that way either to eliminate bounds-checking for every element access or for memory effeciency since it's a value type (struct).
seazium,
I tried both M[][] and myMatrix[i,j](ref your link) neithe works with the DirectX Matrix. (also, my for() statement was corrected for the obvius i/row, j/col issue)
oh well, as usual, writing 12 lines took less time than trying to make the above code work. My 12 lines work fine & I've moved on.

Thanks guys,
Steve