RAD Studio VCL Reference
|
Provides access to the Windows GDI bitmap handle for accessing the GDI bitmap object.
property Handle: HBITMAP;
__property HBITMAP Handle;
Use Handle to call a Windows API function that requires the handle of a bitmap object. Pass Handle as the bitmap handle parameter to these functions.
Handle is the HBITMAP encapsulated by the bitmap object. Avoid grabbing the handle directly since it causes the HBITMAP to be copied if more than one TBitmap shares the handle.
Delphi Examples:
{ This example shows how to add custom cursors to an application. The following code makes this cursor available to the application via the constant crMyCursor, and sets it as the global cursor to the application. } var bmpMask : TBitmap; bmpColor : TBitmap; iconInfo : TIconInfo; const crMyCursor = 5; procedure TForm1.Button2Click(Sender: TObject); begin bmpMask := TBitmap.Create; bmpColor := TBitmap.Create; bmpMask.LoadFromFile('SquareMask.bmp'); bmpColor.LoadFromFile('Square.bmp'); with iconInfo do begin fIcon := false; xHotspot := 15; yHotspot := 15; hbmMask := bmpMask.Handle; hbmColor := bmpColor.Handle; end; Screen.Cursors[crMyCursor] := CreateIconIndirect(iconInfo); Screen.Cursor := crMyCursor; bmpMask.Free; bmpColor.Free; end; procedure TForm1.FormDestroy(Sender: TObject); begin DestroyIcon(Screen.Cursors[crMyCursor]); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|