Control transparency - temporary bmp

I'm trying to make my hexagon color picker XP
compatible, but since I'm drawing to a bmp and then using canvas.draw -
the parent background isn't painted (gets overpainted), and if I use
bmp.transparent the thing is tooo slow and flickery. I tried
DrawParentBackGround(Handle, bmp.canvas.handle, nil, false), but
nothing happends. What should I do, it looks terrible with WinXP (at least on a TTabControl)?

You can take a look at the screenshot at: http://mxs.topcities.com/hexa.png

Any help GREATLY appreciated!!!
BindzaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EKIMCommented:
Hi bindza,
as far as I remember, the transparent color It the color of the Lower-left pixel.
When you draw the bmp, set the lower left pixel to the needed color (I your case, parent color).

@+
Ekim
0
BindzaAuthor Commented:
You didn't understand, if I use bmp.transparent and the thing is resized there's unbearable flickering and very very bad system performance. Also, I can fill the bmp with the parent's color, but then I will end up with a solid back, but what if the parent is gradient - take a look at the screenshot - TTabSheet with XPMan. The bottom line is: the painting procedure doesn't touch the back, it only draws the haxagons, so I think I should either find a super-fast way to make bmp back transparent or draw the parent back onto the bmp before the hexagons are drawn (i tried with ThemeServices.DrawParentBackground, but didn't get anything painted).
0
DragonSlayerCommented:
erm... try capturing a Rect of the Parent's background first, then draw whatever you want on it and finally blt it back to the parent?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

BindzaAuthor Commented:
Can you give me some code, I don't know hot to "capture a Rect of the parent's background", I did think of it, but didn't know exactly how to do it.

[What do you mean by "blt it back to the parent"? I've got my component and all I wanna do is draw a parent background to a bmp, then draw the control over it and put it onto the screen via canvas.draw, I'm not trying to draw onto the parent...]
0
BindzaAuthor Commented:
Never mind, a friend helped me solve it, here it is:

uses Themes;

procedure TLColorPicker.PaintParentBack;
var
 OffScreen: TBitmap;
 MemDC: HDC;
 OldBMP: HBITMAP;
begin
 Offscreen := TBitmap.Create;
 try
  Offscreen.Width := Width;
  Offscreen.Height := Height;
  Offscreen.Canvas.Brush.Color := Color;
  Offscreen.Canvas.FillRect(Offscreen.Canvas.ClipRect);
  if ParentBackground then
   with ThemeServices do
    if ThemesEnabled then
     begin
      MemDC := CreateCompatibleDC(0);
      OldBMP := SelectObject(MemDC, OffScreen.Handle);
      DrawParentBackground(Handle, MemDC, nil, False);
      if OldBMP <> 0 then SelectObject(MemDC, OldBMP);
      if MemDC <> 0 then DeleteDC(MemDC);
     end;
  Canvas.Draw(0, 0, Offscreen);
 finally
  Offscreen.Free;
 end;
end;
0
CetusMODCommented:
Question PAQ'd
250 points refunded.

CetusMOD
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.