Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Starting external program from VFP and waiting for its termination
Using named pipes for interprocess communication
Yet another modal dialog: now HTML-based
Creating a unique filename based on existing filename
Drawing a rectangle using Windows regular edges and borders
Obtaining some properties for the Windows desktop using the GetWindowPlacement function
Reading the structure of VFP main menu
GDI+: printing vertical text on VFP reports via generated images (VFP9)
GDI+: saving image of FoxPro form to graphics file (BMP, GIF, JPG, PNG, TIF)
How to view icons stored in executable files (Icon Viewer)
Quering Audio Mixer Device
Using Extended MessageBox() Class
Writing entries to custom Event Log
GDI+: printing vertical text on VFP reports via generated images (VFP8)
How to control Adobe Reader 9.0 (SDI mode) from VFP application
Reading VFP settings from the Windows Registry
Winsock: reading and setting socket options
Finding out if the current user is the Guest account
How to delete IE cookies, clear IE history and delete files in Temporary Internet Files directory
Placing an arbitrary rectangular area of main VFP window on the Clipboard
Displaying OS Memory Status
Drawing cursors for the classes defined by the system (preregistered): BUTTON, EDIT, LISTBOX etc.
Enumerating print processors and supporting data types installed on the specified server
Enumerating printer drivers installed
GDI+: rotating images using matrix transformations

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.



See also:
  • GDI+: creating scaled copy of image file
  • GDI+: cropping images

  •  
    LOCAL cSourceFile, cTargetFile
    cSourceFile = "provide valid image file name"
    cTargetFile = "c:\temp\test.bmp"
     
    SET PROCEDURE TO gdiplus ADDITIVE
     
    PRIVATE gdiplus As gdiplusinit, srcImage As gdiimage,;
        dstBitmap As gdibitmap
     
    gdiplus = CREATEOBJECT("gdiplusinit")
     
    srcImage = CREATEOBJECT("gdiimage", m.cSourceFile)
    IF srcImage.himage = 0
        = MESSAGEBOX(cSourceFile + "     ",;
            48, "Invalid file format or file not found")
        RETURN
    ENDIF
     
    dstBitmap = CREATEOBJECT("gdibitmap",;
        srcImage*2, srcImage*1.5)
     
    WITH dstBitmap
        * fill background
        .graphics.FillRectangle(ARGB(71,89,73,255),;
            0, 0, .imgwidth, .imgheight)
     
        * copy as is
        .graphics.drawimage(m.srcImage, 0,0)
     
        * copy with several rotation angles
        = DrawImage(-35, 100,0)
        = DrawImage(-25, 0,0)
        = DrawImage(-5, 0,0)
        = DrawImage(25, 0,0)
     
        .SaveToFile(cTargetFile)
    ENDWITH
     
    PROCEDURE DrawImage(nAngle, dx, dy)
        LOCAL oMatrix As gdimatrix
     
        oMatrix = CREATEOBJECT("gdimatrix")
        oMatrix.Translate(srcImage.imgwidth/2, srcImage.imgheight/2)
        oMatrix.Rotate(m.nAngle)
     
        WITH dstBitmap
            .graphics.SetTransform(oMatrix)
            .graphics.drawimage(m.srcImage, dx, dy)
        ENDWITH
     
     
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1179 bytes  
    Created: 2007-03-06 18:52:42  
    Modified: 2007-03-08 19:45:49  
    Visits in 7 days: 66  
    Listed functions:
    Printer friendly API declarations
    My comment:
    GdipImageRotateFlip function provides only limited rotation capabilities.
    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 (50.19.155.235)
    3.09 hrs.Example: 'Creating irregularly shaped FoxPro form using transparency color key'
    5.25 hrs.Function: 'NetScheduleJobDel'
    Function group: 'Network Management'
     Example: 'Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)'
    5.37 hrs.Function: 'OpenProcess'
    Function group: 'Process and Thread'
    6.47 hrs.Example: 'Pocket PC: custom RAPI class for operating with the Object Store Databases'
    9.47 hrs.Example: 'Sending email messages with Simple MAPI'
     Function: 'CeOpenDatabase'
    21.3 hrs.Example: 'How to generate UUID values'
     Function: 'CopyFileTransacted'
    23.26 hrs.Function: 'DeleteService'
    Google
    Advertise here!