Autor Beitrag
huhn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Do 04.05.06 20:11 
Hi Leute,
ich will mal eine form machen die Halbdurchsichtig ist, die buttons etc jedoch normal zu sehen sind(ansonsten hätte ich einfach alphablending der form genommen xD ).
Google und die Forumsuche haben mir viel gegeben aber leider nicht so das richtige(ich will nur den hintergrund halbtransparent haben, also nicht alles und au net alles total transparent xD).
Ich bin für jede idee und codeschnipsel dankbar^^

mfg huhn

_________________
Quod Erat Demonstrandum-Was zu beweisen war! *THX to Chrissivo!*
huhn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Fr 05.05.06 15:25 
habt ihr noch ideen?
mein bisheriger ansatz(screenshot vom window bereich(solange form ausblenden) und dann mit alpha drüberzeichnen und das am besten immer im OnPaint):
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
function GetScreenShot(form:TForm): TBitmap;
var
  Desktop: HDC;
begin
  Result  := TBitmap.Create;
  form.Visible:=false;
  Desktop := GetDC(0);
  try
    try
      Result.PixelFormat := pf32bit;
      Result.Width := form.Width; //Screen.Width
      Result.Height := form.Width; //Screen.Height
      BitBlt(Result.Canvas.Handle, 0, 0, Result.Width, Result.Height,Desktop,0,0,SRCCOPY);
      Result.Modified := True;
      form.Visible:=true;
    finally
      ReleaseDC(0, Desktop);
    end;
  except
    Result.Free;
    form.Visible:=true;
    Result := nil;
  end;
end;

procedure makeAlpha(form:TForm;alpha:integer);
var Overlay: TBitmap;
    BlendFunction: TBlendFunction;
    t1,t2:ttime;
begin
     t1:=time;

     Overlay := TBitmap.Create;
     Overlay := GetScreenShot(form);
     {Overlay.Height := Form1.Height; //Change these 500s to 1 or 2500 or 499
     Overlay.Width := Form1.Width; //and you can see the time difference!
    overlay.canvas.brush.color:=$33CC66;
    overlay.canvas.fillrect(rect(0,0,overlay.width,overlay.height));}


     BlendFunction.AlphaFormat := 0;
     BlendFunction.BlendFlags := 0;
     BlendFunction.BlendOp := AC_SRC_OVER;
     BlendFunction.SourceConstantAlpha := alpha; //(0..255)  128

     Windows.AlphaBlend(Form.Canvas.Handle, 0, 0, Form.Height, Form.Width,
                         Overlay.Canvas.Handle, 0, 0, Overlay.Width, Overlay.Height, BlendFunction);
     t2:=time;
     showmessage(floatTostr(t2-t1));

     Overlay.Free;
end;

funktioniert aba nooch net ganz^^
mfg huhn

_________________
Quod Erat Demonstrandum-Was zu beweisen war! *THX to Chrissivo!*
huhn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Sa 06.05.06 11:38 
will mir keiner helfen?

_________________
Quod Erat Demonstrandum-Was zu beweisen war! *THX to Chrissivo!*
nullplan001
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 212

Win 2000 Professional, Debian Linux 4.0 (Etch,Stable)
Pascal (FreePascal 2.0.2, TurboPascal 7.0), C(++) (G++/GCC 3.4.2 + MinGW), Java (JDK 1.5.0_07), PHP (PHP 5.1.4)
BeitragVerfasst: Sa 06.05.06 12:09 
user profile iconhuhn hat folgendes geschrieben:
will mir keiner helfen?

Dir kann keiner helfen. Ich habe nämlich momentan keinen Durchblick, was du eigentlich willst. Halbdurchsichtig -> Alphablending. Die Controls sollen aber normal sichtbar sein. Wieso dat denn? Sieht doch sch...lecht aus! Ich empfehle, die Verrenkungen einzustellen und normales Alphablending zu nehmen.
Tschö,
nullplan

_________________
Ich fahr' nicht selber, weil ich festgestellt habe: ich fahre zu emotional. Bin 180 gefahren wo 30 erlaubt war... -- Jürgen von der Lippe
Calyptus
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 386

Win Xp Prof
D3, D6 Pers, D7 Ent
BeitragVerfasst: Sa 06.05.06 15:10 
user profile iconnullplan001 hat folgendes geschrieben:
Wieso dat denn? Sieht doch sch...lecht aus! Ich empfehle, die Verrenkungen einzustellen und normales Alphablending zu nehmen.

Halbtransparente Buttons gehören zu den schlimmsten Dingen wie man sein Programm verunstalten kann! Halbtransparenter 'Programmhintergrund' ist ja ok, aber wenn man nicht genau erkennen kann wo man eingentlich draufklickt ists doch wirklich schwachsinnig!

@huhn: Ich suche nach dem gleichen hab bis jetzt aber leider noch nichts brauchbares gefunden :(

_________________
Luft- und Raumfahrtechnik an der Uni Stuttgart
huhn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: So 07.05.06 11:20 
@nullplan001: Dein Name spricht Bände....ziemlich unhöfflich...Anwendung findet sowas übrigens öfter als du denkst!
@Calyptus: Gut dann bin ich schonmal nicht alleine^^

Eigentlich will ich den Formhintergund stufenlos durchsichtigmachen, mit alpha eben(weil ich dafür was nettes gefunden habe).
Das mit den Screenshot machen geht einigermaßen ist aber verdammt langsam weswegen ich mich nach was anderem umschauen sollte (oder jemand hilft mir).

mfg huhn

_________________
Quod Erat Demonstrandum-Was zu beweisen war! *THX to Chrissivo!*
Stefan-W
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 475

Win 7 SP1
D2005 PE
BeitragVerfasst: So 07.05.06 11:39 
ich beobachte den Beitrag hier schon von anfang an, weil mich das Thema auch sehr interessiert eine lösung hab ich allerdings auch nicht :-(
huhn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Mo 08.05.06 18:55 
So hab mal was anderes probiert^^ hab die form transparent und dann screenshot von der stelle gemacht. kommt aber au net so gut raus, und kostet ziemlich ressis.
deswegen nomal *schieb*
mfg huhn

_________________
Quod Erat Demonstrandum-Was zu beweisen war! *THX to Chrissivo!*
huhn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 272
Erhaltene Danke: 1

WIN XP
D7Pers
BeitragVerfasst: Mi 10.05.06 22:26 
so noch einmal ein letztes *schieb*
vielleicht bekomm ich ja jetzt ma ne antwort *g*
mfg huhn

_________________
Quod Erat Demonstrandum-Was zu beweisen war! *THX to Chrissivo!*
MDX
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 595
Erhaltene Danke: 4

Windows 8.1, Linux Debian 8, Android Lollipop
Delphi, PHP, Java (Android)
BeitragVerfasst: Mo 01.10.07 13:46 
Okay, Thread ist schon älter, hab aber was gefunden was vielleciht funkt (Habs noch nicht ausprobiert :lol: ):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
const
LWA_ALPHA = $2;
WS_EX_LAYERED = $80000;

function SetLayeredWindowAttributes (const hWnd : HWND;
crKey : Integer; bAlpha : Byte;
dwFlags : Integer) : Integer; stdcall; external 'user32.dll';

procedure TForm1.FormCreate(Sender: TObject);
var temp : Integer;
begin
temp := GetWindowLong(Handle, GWL_EXSTYLE);
temp := temp or WS_EX_LAYERED;
SetWindowLong(Handle, GWL_EXSTYLE, temp);
SetLayeredWindowAttributes(Handle, 0, 200, LWA_ALPHA);
end;

//erst ab Windows 2000


Bitte um Rücksprache!

David
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: Mo 01.10.07 14:28 
wie wäre denn folgende Idee:
2 Forms exakt aufeinanderlegen, die unterste mit alphablending, die oberste ohne alphablending, aber mit transparent auf true und die Farbe entspricht dem Transparent-Color. Die ist dann unsichtbar. Auf dieser dann alle Buttons etc. Die dürften dann ja zu sehen sein.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 01.10.07 15:10 
Sehr unsauber :lol: Da ist die Funktion von david-kurz viel besser und funktioniert.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: Di 02.10.07 07:14 
war ja nur ne (theoretische) Idee :P
gdvLive
Hält's aus hier
Beiträge: 17



BeitragVerfasst: Do 18.10.07 12:21 
Also bei mir wird bei dem Vorschlag von David auch alles transparent, da würde ja theoretisch auch das AlphaBlend (Delphi 2007) reichen... aber etwas wo nur der Form-Canvas transparent wird gibts nicht, oder?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 18.10.07 12:39 
Bei mir funktioniert das von david. Das Form wird transparent und die Buttons bleiben sichtbar.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
jvkh
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Do 01.11.07 14:13 
Das Thema brannte mir auch schon seit einiger Zeit unter den Nägel. Bei der Funktion von david werden bei mir leider auch die Buttons transparent. Ich finde daher den Vorschlag mit den beiden überlagernden Fenstern gar nicht schlecht. Auch, wenn es "unsauber" ist, jedenfalls funktioniert´s. Dummerweise klappt das aber nur, wenn beide Fenster Top-Level-Fenstern sind. Dabei muss man natürlich beachten, dass die beiden Fenster bzgl. der Z-Order immer richtig hintereinander liegen, damit sich kein anderes Fenster dazwischenschieben kann. Ich habe ein bisschen rumexperimentiert und das kleine Testprogramm in "Transparent.zip" angehängt.
Vieleicht hilft´s...
Einloggen, um Attachments anzusehen!