How to Dynamically drawing a transparent image ?
Answer / Avneet Kumar Gill
To draw a transparent image dynamically in Delphi, you can use the TBitmap and AlphaBlend functions. Here's an example:nn```delphinprocedure DrawTransparentImage(Canvas: TCanvas; const Bitmap: TBitmap; const Alpha: Byte);nvarn SrcRect, DestRect: TRect;nbeginn // Get the size of the bitmap and set source and destination rectanglesnn SrcRect.Left := 0;n SrcRect.Top := 0;n SrcRect.Right := Bitmap.Width;n SrcRect.Bottom := Bitmap.Height;nn DestRect.Left := 0;n DestRect.Top := 0;n DestRect.Right := Canvas.Width;n DestRect.Bottom := Canvas.Height;nn // Draw the bitmap with alpha blendingn AlphaBlend(Canvas.Handle, DestRect.Left, DestRect.Top, SrcRect.Left, SrcRect.Top, Bitmap.Handle, SrcRect.Left, SrcRect.Top, SrcRect.Width, SrcRect.Height, RGB(255, 255, 255), Alpha);nend;n```
| Is This Answer Correct ? | 0 Yes | 0 No |
How to add system menu items to a form ?
How to Set custom tabstops in a ListBox?
How to Allot CPU time ?
How to assign a file variable in a Record?
How to make the TDateTimePicker display blank?
How to Determine if Delphi Running?
How to get the coding for : Well-ordered numbers
How to Write a raw string of data to the printer?
How to Disable system menu in code?
what are the Steps to uninstall and reinstall Delphi 6 ?
How to Align maximized forms?
what are the Versions of DB2 supported by BDE 5.10 ?