Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3872166
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:53:45+00:00 2026-05-19T21:53:45+00:00

I have a caution image on a dialog that is shown if there are

  • 0

I have a “caution” image on a dialog that is shown if there are questionable parameter values. Users do not always notice it, so I want to fade it in and out cyclically over a second or so (yes, I could just toggle the Visible property, but that would look a bit like I was just toggling the Visible property). Is there a simpler way than putting it on it’s own form and floating it over the dialog (and changing the AlphaBlendValue property of the form)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T21:53:45+00:00Added an answer on May 19, 2026 at 9:53 pm

    You can do this using the Opacity parameter of TCanvas.Draw. Behind the scenes this calls TGraphic.DrawTransparent which in turn calls the Windows AlphaBlend API function. An easy way to implement this is with a TPaintBox:

    procedure TAlphaBlendForm.FormCreate(Sender: TObject);
    begin
      FBitmap := TBitmap.Create;
      FBitmap.Assign(Image1.Picture.Graphic);//Image1 contains a transparent PNG
      PaintBox1.Width := FBitmap.Width;
      PaintBox1.Height := FBitmap.Height;
      Timer1.Interval := 20;
    end;
    
    procedure TAlphaBlendForm.PaintBox1Paint(Sender: TObject);
    begin
      PaintBox1.Canvas.Draw(0, 0, FBitmap, FOpacity);
    end;
    
    procedure TAlphaBlendForm.Timer1Timer(Sender: TObject);
    begin
      FOpacity:= (FOpacity+1) mod 256;
      PaintBox1.Invalidate;
    end;
    

    If you are using an older version of Delphi without the Opacity parameter of TCanvas.Draw you can use AlphaBlend directly.

    procedure TAlphaBlendForm.PaintBox1Paint(Sender: TObject);
    var
      fn: TBlendFunction;
    begin
      fn.BlendOp := AC_SRC_OVER;
      fn.BlendFlags := 0;
      fn.SourceConstantAlpha := FOpacity;
      fn.AlphaFormat := AC_SRC_ALPHA;
      Windows.AlphaBlend(
        PaintBox1.Canvas.Handle,
        0,
        0,
        PaintBox1.Width,
        PaintBox1.Height,
        FBitmap.Canvas.Handle,
        0,
        0,
        FBitmap.Width,
        FBitmap.Height,
        fn
      );
    end;
    

    Thanks to Giel for suggesting the Opacity parameter of TCanvas.Draw, and for Sertac for pointing out that it is quite a recent addition to TCanvas.Draw.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a thumbnail image that when you click it changes a larger image
I have a jquery Image slider in a content page that worked fine. Once
I have an image gallery that, at the moment, displays only images. I would
I have got the following code to show a dialog box when the image
I have the stream_publish permission but it still pops up a dialog and there
I have an XML file (a sitemap using Google's <image:image> extensions) that I need
Please help me center a div that does not have a predefined width, inside
I have a string that looks something like this: {{imagename.jpg|left|The caption for this image.
I have an iphone app that lets users post a 'story' to their facebook
Is there any way to have a default MessageBox.Show() caption? Let says I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.