gdiPlus stringFormat object behavior
Posted: 22 Apr 2024 20:26
A gdiPlus stringFormat object seems to behave like a persistent object between clauses.
If I create stringFormat object in the onPaint/3 clause of a dialog, and in a sububordinate clause called by onPaint/3 create a new stringFormat object with different formatFlags (e.g., stringFormatFlagsDirectionVertical) then the next pass through onPaint/3 clause creates a stringFormatter object with the stringFormatFlagsDirectionVertical flag set.
It is not a problem to restore the original formatFlags in the subordinate clause, but it is unexpected behavior.
Sample code from a test dialog is attached.
If I create stringFormat object in the onPaint/3 clause of a dialog, and in a sububordinate clause called by onPaint/3 create a new stringFormat object with different formatFlags (e.g., stringFormatFlagsDirectionVertical) then the next pass through onPaint/3 clause creates a stringFormatter object with the stringFormatFlagsDirectionVertical flag set.
It is not a problem to restore the original formatFlags in the subordinate clause, but it is unexpected behavior.
Sample code from a test dialog is attached.