DynaPDF Manual - Page 126

Previous Page 125   Index   Next Page 127

Function Reference
Page 126 of 839
AddButtonImage
Syntax:
SI32 pdfAddButtonImage(
const PPDF* IPDF,
// Instance pointer
UI32 BtnHandle,
// Handle of the button which should get the image
TButtonState State,
// Button state, see below
const char* Caption, // Caption to be printed over the image or NULL
const char* ImgFile) // Image file
typedef enum
{
bsUp,
// Normal up state of the button
bsDown,
// Down state, button is pressed
bsRollOver // Rollover state, when moving the cursor over the button
}TButtonState;
The function adds an image to a push button to one or more of the three different states of a button.
The parameter BtnHandle must be handle of a button field that was returned by a CreateButton()
function call. The parameter State defines the button state in which the image should appear. Each
state is optional; it is possible to add different images to all three states of the button. The rollover
state should get a different image than the other states. If two states should get the same image, the
image is physically inserted only once to the PDF file.
DynaPDF checks whether duplicate images are already available before inserting an image again.
Depending on the parameter UseTransparency the image appears with a transparent background or
opaque (default transparent). However, note that the background of the button must be transparent
too to get a transparent button. Otherwise the button is still opaque due the opaque background of
the button.
The parameter Caption is optional, it can be NULL. Each state can contain its own caption which is
drawn horizontally and vertically centered by default. The alignment can be changed with the
function SetFieldTextAlign(). Because each button state is directly drawn when calling the function,
the alignment must be set before this function is called.
If a button has already an image for a specific button state, the existing image will be replaced with
the new one.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
 

Previous topic: AddBookmarkEx2

Next topic: AddButtonImageEx, AddButtonImageEx2