Microsoft KB Archive/66888

INF: Sample PM 1.21 Program Generates “Shadow” Effect PSS ID Number: Q66888 Article last modified on 09-06-1991 PSS database name: P_PresMan

1.21

OS/2

Summary:

In the Software/Data Library is a file named CHANGDIR containing a sample program that generates a “shadow” effect if Shadow text is selected from the menu.

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

The following function, DrawShadowText, draws a “shadow” style. This is done by drawing the text in a gray tone, moving the string display point by 3 pixels, and then drawing the text a second time in black. CLR_PALEGRAY can also be used, depending upon the programmer’s taste, and the number of pixels the user moves the string over can also be changed.

VOID DrawShadowText( HWND hwnd ) { HPS hps; POINTL ptl;

// Get a handle to the presentation space. hps = WinGetPS( hwnd ); // Erase the screen. GpiErase(hps); // Set the display point. ptl.x = 50L ; ptl.y = 50L ; // Write out the text in dark gray. GpiSetColor( hps, CLR_DARKGRAY ); GpiCharStringAt(hps, &ptl, 5, &quot;Hello&quot; ); // Set the display point up 3 pixels in both X and Y direction. ptl.x = 53L ; ptl.y = 53L ; // Draw the text again, this time in black. GpiSetColor( hps, CLR_BLACK ); GpiCharStringAt(hps, &ptl, 5, &quot;Hello&quot; ); // Release the Presentation Space. WinReleasePS( hps ); }

Copyright Microsoft Corporation 1991.