Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to test file attributes (key method for FileExists and DirectoryExists routines)
Listing INF files in a specified directory
Obtaining provider name for a specific type of network
Retrieving a universal form for the drive-based path for a network resource
Retrieving list of Global Atom names
Retrieving Network Provider information
Setting the volume label
WAV file recorder
Displaying the main Dial-Up Networking dialog box
Enumerating network sessions established on a server
GDI+: Storing DLL icon resources in image files
How to access a file using not its name but an alias (hard link)
How to get the path to a Special Folder
How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement
Pocket PC: enumerating mounted database volumes and databases in the Object Store
Retrieving configuration information for the specified server (Win98/Me)
Retrieving list of all active RAS connections
Retrieving statistics for the TCP protocol running on the local computer
Retrieving the priority class for the current process
Using the MessageBox Win32 function
Converting long file names to the short format and vice versa
Creating a file, then moving it to another destination
Displaying the drive type value
Managing Cookies
GDI+: loading image file, drawing on it, saving the result to another 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
click to open
Before you begin:
The example shows how to load an image file, put semi-transparent frame with a text on it, and save the result to another file.

Make sure the source and target file names are valid. The source file can be in any of graphics formats supported by the GDI+: BMP, GIF, JPG, TIF, EMF...

The code is based on custom GDI+ class. Download the class module first and save it in gdiplus.prg file.

PRIVATE gdiplus, src, dst, himage
gdiplus = CREATEOBJECT("gdiplusinit")

src = CREATEOBJECT("gdiimage", "c:\windows\forest.bmp")
dst = CREATEOBJECT("gdiimage", src)

IF dst.imgtype=0 OR VARTYPE( <> "O"
    ? "Error code:", dst.errorcode

LOCAL gdibrush, gdipen, fnt
STORE 0 TO gdibrush, gdipen

* creating brush, pen and font objects
* note that the alpha channel is defined for the solid brush,
* which creates semi-transparent fill
= GdipCreateSolidFill(ARGB(255,255,255, 128), @gdibrush)
= GdipCreatePen1(ARGB(220,220,255), 2, 2, @gdipen)
fnt = CREATEOBJECT("gdifont", "Arial", 24, 1, ARGB(220,220,255))

* drawing filled semi-transparent rectangle with a border
= GdipFillRectangle(, gdibrush, 5,5, 160,50)
= GdipDrawRectangle(, gdipen, 5,5, 160,50)

* printing text
    fnt, 10,10, dst.imgwidth-10, 0)

* releasing system resources
= GdipDeletePen(gdipen)
= GdipDeleteBrush(gdibrush)

* creating drawing surface based on main VFP window
gr = CREATEOBJECT("graphics", _screen.HWnd)

gr.DrawImage(src, 20,20)
gr.DrawImage(dst, 20+src.imgwidth+5,20)

*= dst.SaveToFile("d:\temp\tmp.bmp")

* end of main

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1294 bytes  
Created: 2004-07-22 12:43:04  
Modified: 2005-10-13 10:33:55  
Visits in 7 days: 24  
Listed functions:
Printer friendly API declarations
My comment:
The transparency is controlled by the alpha-channel value. In this particular example a semi-transparent solid brush is used.

#kwd: sln_gdiplus.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian 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.35), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
9 sec.Function: 'NetApiBufferFree'
18 sec.Example: 'How to create MD-5 and SHA-1 hash values from a string'
27 sec.
Function group: 'GDI+ Graphics'
37 sec.Function: 'CryptGetProvParam'
Function group: 'Cryptography Reference'
47 sec.Function: 'AVIFileExit'
Function group: 'Windows Multimedia'
57 sec.Function: 'Escape'
Function group: 'Printing and Print Spooler'
1.13 min.Function: 'FindClose'
Function group: 'File Management'
1.32 min.Example: 'GDI+: sending image of FoxPro form to printer'
1.48 min.Function: 'NetUserGetLocalGroups'
Function group: 'Network Management'
1.63 min.Example: 'How to retrieve the number of objects stored in the Recycle Bin'
Advertise here!