Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Custom GDI+ class
Splash Screen for the VFP application
Displaying dimmed window behind VFP top-level form
Vertical Label control
Subclassing CommandButton control to create BackColor property
Storing content of the Clipboard to a bitmap file
Printing text with the Escape function
How to make a VFP form fading out when released (GDI version)
How to put a vertical text scrolling on the form (a movie cast)
How to put a horizontal text scrolling on the form (a news line, marquee)
Storing screen shot of a form to bitmap file
Bitmap Class for Visual FoxPro application
Playing WAV sounds simultaneously
Custom FTP Class for Visual FoxPro application
How to play AVI file on the _screen
Obtaining names and positions for shortcuts located on the Windows Desktop
Enumerating devices installed on the local machine
How to view icons stored in executable files (Icon Viewer) - II
Enumerating Processes -- WinNT
Passing data records between VFP applications via the Clipboard
Copying picture of the active form to the Clipboard using Enhanced Metafile API functions
CryptoAPI: Collection of Providers class
Monitoring clipboard content changes (VFP9)
Placing an arbitrary rectangular area of main VFP window on the Clipboard
GDI+: printing image file

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
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 source file name is valid. The source file can be in any of graphics formats supported by the GDI+: BMP, GIF, JPG, TIF, EMF...

See also:
  • Printing Image File, programmatically set print page orientation to landscape
  • How to display the Print property sheet
  • SET PROCEDURE TO gdiplus ADDITIVE
    DO decl
    
    * an instance of gdiplusinit should be created before
    * and released after using any of gdi+ objects
    PRIVATE gdiplus
    gdiplus = CREATEOBJECT("gdiplusinit")
    
    LOCAL img, hPrnDC, gdip, docinfo
    hPrnDC = GetPrnDC()
    img = CREATEOBJECT("gdiimage", "c:\windows\forest.bmp")
    gdip = CREATEOBJECT("graphics", hPrnDC)
    
    docinfo = PADR(CHR(20), 20, CHR(0))
    = StartDoc(m.hPrnDC, m.docinfo)
    = StartPage(m.hPrnDC)
    WITH gdip
        .DrawImage(img, 20,20)
        .DrawImage(img, 25+img.imgwidth,20,;
            img.imgwidth/4, img.imgheight/4)
    ENDWITH
    = EndPage(m.hPrnDC)
    = EndDoc(m.hPrnDC)
    = DeleteDC(hPrnDC)
    * end of main
    
    FUNCTION GetPrnDC
    * returns device context of default printer
    #DEFINE PD_RETURNDC      0x100
    #DEFINE PD_RETURNDEFAULT 0x400
        LOCAL lcStruct, lnFlags
        lnFlags = PD_RETURNDEFAULT + PD_RETURNDC
    
        lcStruct = num2dword(66) + Repli(Chr(0), 16) +;
            num2dword(lnFlags) + Repli(Chr(0), 42)
        IF PrintDlg(@lcStruct) <> 0
            RETURN buf2dword (SUBSTR(lcStruct, 17,4))
        ENDIF
    RETURN 0
    
    PROCEDURE decl
        DECLARE INTEGER DeleteDC IN gdi32 INTEGER hdc
        DECLARE INTEGER PrintDlg IN comdlg32 STRING @ lppd
        DECLARE INTEGER StartPage IN gdi32 INTEGER hdc
        DECLARE INTEGER EndPage IN gdi32 INTEGER hdc
        DECLARE INTEGER EndDoc IN gdi32 INTEGER hdc
        DECLARE INTEGER StartDoc IN gdi32 INTEGER hdc, STRING lpdi
    
    
    

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1361 bytes  
    Created: 2004-07-08 09:30:41  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 160  
    Listed functions:
    DeleteDC
    EndDoc
    EndPage
    PrintDlg
    StartDoc
    StartPage
    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-2017 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.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
    Last Topics Visited (54.82.112.193)
    18 sec.Function: 'GdipGetFamilyName'
    54 sec.Function: 'GdipCreateMatrix'
    1.2 min.Example: 'GDI+: Using Scale and Shear transformations'
    1.53 min.Function: 'GdipGetImageHeight'
    2.53 min.Function: 'GdipDeleteFont'
    3.23 min.Function: 'GdipFillRectangle'
    Function group: 'GDI+ Graphics'
    3.58 min.Function: 'IsWindow'
    3.97 min.Function: 'GdipGetFontCollectionFamilyList'
    4.33 min.Function: 'GdipDeleteMatrix'
    4.7 min.Function: 'GdipRotateWorldTransform'
    Function group: 'GDI+ Graphics'
    Google
    Advertise here!