|
Dragging Images
The Win32 API includes functions for dragging an image on the screen. The
dragging functions move an image smoothly, in color, and without any flashing of
the cursor. Both masked and unmasked images can be dragged.
The ImageList_BeginDrag function begins a drag operation. The parameters include the handle of the
image list, the index of the image to drag, and the location of the hot spot
within the image. The hot spot is a single pixel that the dragging functions
recognize as the exact screen location of the image. Typically, an application sets
the hot spot so that it coincides with the hot spot of the mouse cursor. The ImageList_DragMove function moves the image to a new location.
The ImageList_DragEnter function sets the initial position of the drag image within a window and draws
the image at the position. The parameters include the handle of the window in
which to draw the image and the coordinates of the initial position within the
window. The coordinates are relative to the window's upper-left corner, not the
client area. The same is true for all of the image dragging functions that
take coordinates as parameters. This means you must compensate for the widths of
window elements, such as the border, title bar, and menu bar, when specifying
the coordinates. If you specify a NULL window handle when calling ImageList_DragEnter, the dragging functions draw the image in the device context associated with
the desktop window, and the coordinates are relative to the upper-left corner
of the screen.
ImageList_DragEnter locks all other updates to the given window during the drag operation. If you
need to do any drawing during a drag operation, such as highlighting the
target of a drag and drop operation, you can temporarily hide the dragged image by
using the ImageList_DragLeave function. Another method is to use the GetDCEx function with the DCX_LOCKWINDOWUPDATE value to retrieve a device context
that allows you to draw. You must be careful, however, not to obliterate the
dragged image.
The ImageList_SetDragCursorImage creates a new drag image by combining the given image (typically a mouse
cursor image) with the current drag image. Because the dragging functions use the
new image during a drag operation, you should use the ShowCursor function to hide the actual mouse cursor after calling ImageList_SetDragCursorImage. Otherwise, the system may appear to have two mouse cursors for the duration
of the drag operation.
When an application calls ImageList_BeginDrag, the system creates an temporary, internal image list can copies the
specified drag image to the internal list. You can retrieves the handle of the
temporary drag image list by using the ImageList_GetDragImage function. The function also retrieves the current drag position, and the
offset of the drag image relative to the drag position.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|