Using Win32 functions in Visual FoxPro Image Gallery
Painting and Drawing
..msdn
DrawAnimatedRects
DrawCaption
DrawEdge
DrawFrameControl
GdiFlush
GdiGetBatchLimit
GdiSetBatchLimit
GetBkMode
GetBoundsRect
GetWindowDC
GetWindowRgnBox
LockWindowUpdate
PaintDesktop
SetBkColor
SetBkMode
SetWindowRgn
WindowFromDC
Code examples:
Bitmap Class for Visual FoxPro application
Copying picture of the active form to the Clipboard using Enhanced Metafile API functions
Creating a clipping region from the path selected into the device context of a form
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
Displaying bitmap using the AlphaBlend function
Displaying the associated icons and descriptions for files and folders
Drawing a rectangle using Windows regular edges and borders
Drawing a window caption using the DrawCaption routine
Drawing cursors for the classes defined by the system (preregistered): BUTTON, EDIT, LISTBOX etc.
Drawing icons associated with the VFP main window
Drawing Windows frame controls using the DrawFrameControl function
Drawing Windows predefined bitmaps using the LoadBitmap functions
Form Magnifier
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
GDI+: Creating thumbnails to preview images in a directory
GDI+: how to make VFP controls visually shake and shudder
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)
GDI+: Scrolling through large image using the mouse
GDI+: sending image of FoxPro form to printer
How to change the name and the size of the font in the MessageBox dialog
How to copy the image of a form to the Clipboard using Bitmap API functions
How to display picture stored in enhanced-format metafile (*.emf)
How to find which fonts Windows uses for drawing captions, menus and message boxes
How to make a VFP form fading out when released (GDI version)
How to make a VFP form fading out when released (GDI+ version)
How to play AVI file on the _screen
How to print a bitmap file
How to print FoxPro form
How to print FoxPro form -- II
How to print picture stored in enhanced-format metafile (*.emf)
How to put a horizontal text scrolling on the form (a news line)
How to put a vertical text scrolling on the form (a movie cast)
Obtaining the bounding rectangle for the specified device context
Placing an arbitrary rectangular area of main VFP window on the Clipboard
Printing text on the main VFP window
Printing text with the Escape function
Reading metrics for the currently selected font
Splash Screen for the VFP application
Storing content of the Clipboard to a bitmap file
Storing screen shot of a form to bitmap file
Storing screen shot of a form to enhanced metafile (*.emf)
Subclassing CommandButton control to create BackColor property
Using Font and Text functions
Using FrameRgn for displaying system colors
Using the DrawText function
Using the GradientFill function
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
Vertical Label control
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)

User rating: 10/10 (1 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Versions:
click to open
Before you begin:
The code is based on custom GDI+ class. Download the class module first and save it in gdiplus.prg file.

Make sure the target file name is valid. The target file can be created in several graphics format supported by the GDI+: BMP, GIF, JPG, TIF.

Call this code from a method or event of a FoxPro form when that form is active, i.e. posesses the keyboard focus.

See also:
  • GDI: Storing screen shot of a form to bitmap file
  • Printing the image of a FoxPro form
  • Storing clipboard contents to a BMP file
  • Using the LoadImage() to display a BMP file on the main VFP window
  • How to print a bitmap file

  •  
    SET PROCEDURE TO gdiplus ADDITIVE
    #DEFINE SRCCOPY  0x00CC0020
    DO decl
     
    * an instance of gdiplusinit should be created before
    * and released after using any of gdi+ objects
    PRIVATE gdiplus
    gdiplus = CREATEOBJECT("gdiplusinit")
     
    LOCAL hwindow, hdc, bmp, nWidth, nHeight
    hwindow = GetFocus()
    hdc = GetWindowDC(hwindow)
    STORE 0 TO nWidth, nHeight
    = GetWinRect(hwindow, @nWidth, @nHeight)
     
    bmp = CREATEOBJECT("gdibitmap", m.nWidth, m.nHeight)
    WITH bmp
        .graphics.GetDC
        = BitBlt(.graphics.hdc, 0,0, .imgwidth, .imgheight,;
            m.hdc, 0,0, SRCCOPY)
        .graphics.ReleaseDC
        .SaveToFile("d:\temp\vfp.tif")    
    ENDWITH
     
    = ReleaseDC(m.hwindow, m.hdc)
    * end of main
     
    PROCEDURE GetWinRect(hwindow, nWidth, nHeight)
    #DEFINE maxDword  0xffffffff
        LOCAL lpRect, nLeft, nTop, nRight, nBottom
        lpRect = REPLI (Chr(0), 16)
        = GetWindowRect (hwindow, @lpRect)
        nRight  = buf2dword(SUBSTR(lpRect, 9,4))
        nBottom = buf2dword(SUBSTR(lpRect, 13,4))
     
        nLeft = buf2dword(SUBSTR(lpRect, 1,4))
        IF nLeft > nRight
            nLeft = nLeft - maxDword
        ENDIF
        nTop = buf2dword(SUBSTR(lpRect, 5,4))
        IF nTop > nBottom
            nTop = nTop - maxDword
        ENDIF
        nWidth = nRight - nLeft
        nHeight = nBottom - nTop
    RETURN
     
    PROCEDURE decl
        DECLARE INTEGER GetFocus IN user32
        DECLARE INTEGER GetWindowDC IN user32 INTEGER hwindow
        DECLARE INTEGER ReleaseDC IN user32 INTEGER hwindow, INTEGER hdc
        DECLARE INTEGER GetWindowRect IN user32 INTEGER hwnd, STRING @lpRect 
     
        DECLARE INTEGER BitBlt IN gdi32;
            INTEGER hDestDC, INTEGER x, INTEGER y,;
            INTEGER nWidth, INTEGER nHeight, INTEGER hSrcDC,;
            INTEGER xSrc, INTEGER ySrc, INTEGER dwRop
     
     
     

    User rating: 10/10 (1 votes)
    Rate this code sample:
    • ~
    1637 bytes  
    Created: 2004-07-08 21:35:49  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 117  
    Listed functions:
    BitBlt
    GetFocus
    GetWindowDC
    GetWindowRect
    ReleaseDC
    Printer friendly API declarations
    My comment:


    #kwd: sln_gdiplus.
    Word Index links for this example:
    Translate this page:
      Spanish    Portuguese    German    French    Italian  
    FreeTranslation.com offers instant, free translations of text or web pages.
    User Contributed Notes:
    There are no notes on this subject.


    Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

    Privacy policy
    Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (23.22.252.150)
    3 sec.Example: 'Printing text on the client area of the main VFP window'
    4 sec.Example: 'FindText -- the hopeless and useless Common Dialog'
    7.09 hrs.Example: 'How to display the Print property sheet'
    7.21 hrs.Function: 'WNetEnumResource'
    9.43 hrs.Function: 'WNetGetProviderName'
    Function group: 'Windows Networking'
    16.59 hrs.Example: 'Disabling mouse and keyboard input for the main VFP window (with the app still running)'
     Example: 'Splash Screen for the VFP application'
    17.98 hrs.Function: 'AVIFileGetStream'
    21.27 hrs.Example: 'How to put a horizontal text scrolling on the form (a news line)'
     Example: 'Extensible Storage Engine class library'
    Google
    Advertise here!