Microsoft KB Archive/66887

INF: Sample PM Program That Draws Text in Different Directions PSS ID Number: Q66887 Article last modified on 09-06-1991 PSS database name: P_PresMan

1.10 1.21

OS/2

Summary:

The file CHANGDIR in the Software/Data Library contains a sample program that demonstrates how to draw text in directions such as right to left, top to bottom, and so on. CHANGDIR changes the direction of some text (“Hello”, to be specific).

CHANGDIR can be found in the Software/Data Library by searching on the word CHANGDIR, the Q number of this article, or S12793. CHANGDIR was archived using the PKware file-compression utility.

The following function, DrawTheText, is called when a menu item is chosen from the Direction menu. The handle to the client window is passed in along with the direction (CHDIRN_DEFAULT - left to right, CHDRIN_RIGHTLEFT – right to left, CHDIRN_TOPBOTTOM - top to bottom, and CHDIRN_BOTTOMTOP - bottom to top).

VOID DrawTheText( HWND hwnd, LONG fDirection ) { HPS hps; POINTL ptl;

// Get a handle to the presentation space. hps = WinGetPS( hwnd ); // Erase the screen. GpiErase(hps); // Set the direction to the one specified. GpiSetCharDirection( hps, fDirection ); // Set the display point. ptl.x = 50L ; ptl.y = 50L ; // Display the string. GpiCharStringAt(hps, &ptl, 5, &quot;Hello&quot; ); // Release the Presentation Space. WinReleasePS( hps ); }

}

Copyright Microsoft Corporation 1991.