Recent

Author Topic: [SOLVED]transparent TPanel?  (Read 23139 times)

jc99

  • Hero Member
  • *****
  • Posts: 544
    • My private Site
Re: transparent TPanel?
« Reply #15 on: May 26, 2017, 07:49:02 pm »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

majid.ebru

  • Sr. Member
  • ****
  • Posts: 388
Re: transparent TPanel?
« Reply #16 on: May 26, 2017, 08:19:59 pm »
thank you
 :) ;) :D ;D

jc99

  • Hero Member
  • *****
  • Posts: 544
    • My private Site
Re: transparent TPanel?
« Reply #17 on: May 26, 2017, 08:30:07 pm »
Two Screenshots:
With the checkbox you switch the panel on and off.
« Last Edit: May 26, 2017, 08:57:21 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: transparent TPanel?
« Reply #18 on: May 26, 2017, 10:22:24 pm »
Here is a quick and dirty implementation. Its Slow,(really slow but it shows the required steps). I wrote it to test Soner's post for transparency.
https://sourceforge.net/projects/evssimplegraph/files/Release/Samples/TranslucentPanel.rar/download

EDIT:
oh I just show jc99's "more interesting" solution. Really nice! thanks.
« Last Edit: May 26, 2017, 10:37:57 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

RAW

  • Hero Member
  • *****
  • Posts: 867
Re: transparent TPanel?
« Reply #19 on: May 26, 2017, 10:56:38 pm »
Unfortunately this is not working with a classic theme...  :'(
Funny, I can scroll a label inside the panel and it looks good... but yeah, it's too slow...  :D
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.8 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1
// This is polarity (hell) and hell is reigned by lies, nothing but lies. Be careful what you believe ...
// There are 10 types of people in this world, those who understand mind control and ...

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: transparent TPanel?
« Reply #20 on: May 27, 2017, 01:48:11 am »
Unfortunately this is not working with a classic theme...  :'(
Oh! I'll disable the aero theming and see how it works thanks for the heads up.
Funny, I can scroll a label inside the panel and it looks good... but yeah, it's too slow...  :D
Yeah. There are a number of ways to make it faster inlcuding the alphablend function from the windows API. I'll take a closer look when I get a bit more time.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

jc99

  • Hero Member
  • *****
  • Posts: 544
    • My private Site
Re: transparent TPanel?
« Reply #21 on: May 27, 2017, 08:50:42 am »
@taazz:
Making the scrolling of the Label on the panel faster is no problem:
What needs time is the pixel-by-pixel-calculation of the background in the onPaint-method.
So: if you only do the necessary stuff at the necessary point of time. (and nowadays you have enough mem to store precalulated data) you get a BIG acceleration.
1. Calculating the darkend, or maybe somehow other transformed background of the form can be done at the very start of the program, maybe in a second task. It can be even done externaly (e.G: with Paint.net) like I did and be stored in the App. I mean the complete background of the form.
2. in the onpaint-method you "only" have to BitBlit the needed part of that precalculated background on the panel.
[edit]
2a) If you put a Timage on the panel even the redrawing when something is moving on the panel (e.G: the label, mentioned above) is done by the system, and you only have to paint on the Image when you move or resize the panel.
 
« Last Edit: May 27, 2017, 08:57:48 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

Pascal

  • Hero Member
  • *****
  • Posts: 914
Re: transparent TPanel?
« Reply #22 on: July 12, 2017, 01:52:53 pm »
This is very easy, at least on Windows:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   Panel1.ControlStyle := Panel1.ControlStyle - [csOpaque] + [csParentBackground];
  4. end;
  5.  
  6.  

Doesn't this work on other Platforms?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (2004)

wp

  • Hero Member
  • *****
  • Posts: 7640
Re: [SOLVED]transparent TPanel?
« Reply #23 on: July 12, 2017, 05:05:13 pm »
No, Windows only...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Pascal

  • Hero Member
  • *****
  • Posts: 914
Re: [SOLVED]transparent TPanel?
« Reply #24 on: July 12, 2017, 05:54:22 pm »
Is there a way to do it cross platform?
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (2004)

wp

  • Hero Member
  • *****
  • Posts: 7640
Re: [SOLVED]transparent TPanel?
« Reply #25 on: July 12, 2017, 06:00:53 pm »
Nothing is impossible, but nobody did it so far (at least as far as I know). Even the current TPanel behaves differently on different platforms: Win: opaque, gtk2: transparent, qt: opaque. (Maybe I am confusing gtk2 and qt here, but I am sure that in my recent test one of them was transparent).
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

majid.ebru

  • Sr. Member
  • ****
  • Posts: 388
Re: [SOLVED]transparent TPanel?
« Reply #26 on: July 13, 2017, 06:49:03 am »
Is there a way to do it cross platform?

Hi

if it is possible ,use BGRA component

 

TinyPortal © 2005-2018