Transparency in TAdvSmoothPanel

I have a question about transparency.
I'm using a SmoothPanel, on that panel I have to draw a circle and on that circle I have to place transparent PNG images at runtime, I'm using TAdvShapeButton to place the PNG Images

The problem I have is that the transparent background is not taking in account the canvas drawing on the Panel.
I have attached a screenshot.

Does anybody know how to fix this?

Thanks in advance



For drawing it would be better to draw the PNG images as well instead of creating an instance of TAdvShapeButton for each PNG. The transparent technique that is used only applies for TGraphicControl descendants instead.

Kind Regards, 

Thank you for your reply.
Actually the first part I did solve, by not drawing directly to the canvas, but rather make a transparent bitmap, draw to everything in the bitmap and then assign it to the panel, that will solve the color issue.
Only thing left is, when there are to TAdvShapeButton partly placed over each other the transparency is not ok.
That could probably be solved by drawing the images, but I'm using a mouse over and image click function (so actually they act as buttons)
Isn't there a way to still use the buttons?

You could try to use TImage instead of TAdvShapeButton and assign the OnClick event. TImage inherits from TGraphicControl and doesn't take on the color of the parent, so they should be transparent.

Thanks for the answer. I replaced it with a TImage, and indeed the transparency is fixed, but a new problem pops up, the events (Onclick) doesn't get fired, when I put the image on the main form it works just fine. Also when I put it on the main form (parent) and I place it under the TAdvPanel, bring it to the front, it's still not visible.


The only alternative is to draw the png's on top of the grid and then write functionality to retrieve the png under the X and Y coördinates in the OnMouseUp event of the TAdvSmoothPanel.

Hmm... that's indeed an option, but why is it that the Smoothpanel has so much issues with components placed on the panel?
I think the whole idea of a panel is to place components on top of it.
Could this be fixed?

The AdvSmoothPanel does not have issue placing components on top, please note that you are custom drawing on the panel, which is not recognized by the components that are placed on "top". You have probably drawn the circle directly on the Canvas (GDI). To achieve full transparency you will need to switch to GDI+, by adding the AdvGDIP unit. Then you will be able to drop TAdvShapeButton instances that will have "transparent" backgrounds.

Below is a sample using GDI+

procedure TForm1.AdvSmoothPanel1Draw(Sender: TObject; Canvas: TCanvas;
  Rect: TRect);
  g: TGPGraphics;
  b: TGPSolidBrush;
  g := TGPGraphics.Create(Canvas.Handle);
  b := TGPSolidBrush.Create(MakeColor(255, clBlue));
  g.FillRectangle(b, MakeRect(Rect.Left + 10, Rect.Top + 30, Rect.Right - 30, Rect.Bottom - 50));

In my test (not as showed in the picture) I did not draw on the panel, just placed a TImage on it, nothing more.
For making the TImage transparent, I allready used GDI+, as I posted the transparency is correct now, only the onclick is not working on the TImage when placed on the SmoothPanel.

We have tried to reproduce this here, with a TImage as a child of the panel, and then placing a TAdvShapeButton instance makes it have a transparent background. Can you perhaps send us a test project so we can investigate here what exactly is going wrong?

I don't use the TAdvShapeButton anymore as you suggested, I have replaced this with TImage, transparency is fine now, only the onclick of the TImage is not working.

My setup is like this
MainForm -> TAdvSmoothTabPage -> TAdvSmoothPanel -> TImage

TAdvShapeButton transparency should work, as we have tested here now:

What I did was I had one TAdvShapeButton the the form, at runtime I cloned this component a couple of times and moved it over the SmoothPanel, what I saw was that the transparency didn't get updated.
You told me, use a TImage, I did and that one works fine, after moving the transparency is still ok, also when I draw on the canvas, that didn't work with TAdvShapeButton.
So My transparency issue is solved, only the onclick of TImage is not working.
After that I mad a test, no cloning, no drawing, just 1 TImage at designtime on the AdvSmoothPanel, still no onclick.
Placed the same TImage on the mainform, nd the onclick worked

Any idea how to fix this?

If you are creating TAdvShapeButton on the form, did you set the parent of the TAdvShapeButton to the panel? We have tried to recreate the project here as the above images demonstrate and we do not see any issue with transparency here, so please provide us with a sample that demonstrates the transparency issue so we can investigate what is missing, going wrong in your application.

Yes I did
I'll try to make a sample.
The issue started when I moved the TAdvSahpeButton to a different location, at creation it's just fine, but when I move it, it doesn't update the background.
But that leaves the TImage issue still open, where the onclick is not working when it's placed on a TAdvSmoothPanel.

What I figured later is that when I place a TAdvSmoothProgressBar on the TAdvSmoothPanel with rouned borders, the part where it's rounded, the background is black (so that seems again a transparency issue)
I can make a screenshot if you want.


I cannot see any of these problems.
You can download a test app here with image on TAdvSmoothPanel where OnClick is working and a TAdvSmoothProgressBar on this panel as well that also does not cause any painting issue. 
If a problem persists, please provide us by email with a sample source project, using the latest version of the components, with clear steps & details how to reproduce a problem.

Thanks for the reply,
The test is a good example, you can reproduce the problem by Setting the rounding to 5  in the Appearances->Background (TGDIPFill) in AdvSmoothProgressBar1.
If you do that, you'll see black spots appear around the AdvSmoothProgressBar

We have been able to reproduce the issue with TAdvSmoothProgressBar, and applied a fix for this issue, yet the issue with TAdvShapeButton is not reproducible.