Autor Beitrag
Cashels
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167



BeitragVerfasst: Di 25.06.02 11:25 
Hallo,

ich hab eine Lösung zu einem Problem relatriv elegant mit Frames gelöst gekiregt. Mein auftraggeber hat jetzt jedoch spezifische grafische Anforderungen gestellt, unter anderem soll das Form mit einer Grafik hinterlegt werden. Jetzt hab ich das Problem, dass ich meine Frames nicht transparent darstellen kann. Die Grafik wird also grösstenteils verdeckt!

Besteht da Abhilfe?

Gruss,
Tom
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 25.06.02 11:31 
Ob es Abhilfe gibt: Den Auftraggeber mal nach dem Grund fragen warum dort ein Hintergrundbild rein soll. Mir fällt nämilich kein Grund ein!

Gruß
Cashels Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167



BeitragVerfasst: Di 25.06.02 11:40 
Hi Tino,

da gibts nicht viel zu erklären. Es handelt sich dabei um einen großen Konzern, die alle ihre Programme einheiltich gestalten damit all ihre Mitarbeiter auf Anhieb damit klar kommen sollen. Ich habs auch nicht erfunden, kann aber leider nix an der Tatsache ändern. Ich brauch also unbedingt eine Lösung... Meine Meinung mit dem Hintergrundbild ist es auch nicht, aber was soll man machen.

Gruss,
Tom
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Di 25.06.02 11:48 
Hallo Cashels,

was für eine Grafik ist es denn? Faällt es auf wenn du in deinen Frames ein Panel verwendest auf dem die Grafik dargestellt wird (ich glaube in's Fame selbst l#sst sich nicht Zeichen).
Fames sind ohnehin ein krittisches Thema. Ich schätze im schimsten Fall must du ermitteln welchen Teil der Hintergrundgrafik dein Frame verdecht, und diesen auf ein Canvas in deinem Frame Kopieren.

Gruß
Klabautermann
Cashels Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167



BeitragVerfasst: Di 25.06.02 18:41 
Hallo Klabautermann,

ich hab das Problem jetzt umgangen indem ich die Frames mal ganz weglasse. War eh nicht die beste Idee glaub ich. Aber eigentlich ists schon schade dass man die Frames nicht transparent darstellen kann. Trotzdem danke für die Hilfestellung.

Gruss,
Tom
Spike
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 69
Erhaltene Danke: 1



BeitragVerfasst: Mi 26.06.02 22:18 
doch, man kann. jedenfalls gehts so mit Form's - müßte aber auch mit Frames funzen

ausblenden 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:
procedure MakeFormInvisible(Form : TForm);
var
  AControl : TControl;
  A, Margin, X, Y, CtlX, CtlY : Integer;
begin
  Margin := ( Form.Width - Form.ClientWidth ) div 2;
  FullRgn := CreateRectRgn(0, 0, Form.Width, Form.Height);
  X := Margin;
  Y := Form.Height - Form.ClientHeight - Margin;
  ClientRgn := CreateRectRgn( X, Y, X + Form.ClientWidth, Y + Form.ClientHeight );
  CombineRgn( FullRgn, FullRgn, ClientRgn, RGN_DIFF );
  for A := 0 to Form.ControlCount - 1 do begin
    AControl := Form.Controls[A];
    if ( AControl is TWinControl ) or ( AControl is TGraphicControl )
        then with AControl do begin
      if Visible then begin
        CtlX := X + Left;
        CtlY := Y + Top;
        CtlRgn := CreateRectRgn( CtlX, CtlY, CtlX + Width, CtlY + Height );
        CombineRgn( FullRgn, FullRgn, CtlRgn, RGN_OR );
      end;
    end;
  end;
  SetWindowRgn(Form.Handle, FullRgn, TRUE);
end;


ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure MakeFormVisible(Form : TForm);
begin
  FullRgn := CreateRectRgn(0, 0, Form.Width, Form.Height);
  CombineRgn(FullRgn, FullRgn, FullRgn, RGN_COPY);
  SetWindowRgn(Form.Handle, FullRgn, TRUE);
  DeleteObject(ClientRgn);
  DeleteObject(FullRgn);
  DeleteObject(CtlRgn);
end;
Cashels Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167



BeitragVerfasst: Do 27.06.02 10:17 
Hi Spike,

immer wieder gut daß es so Freaks gibt wie dich 8) Klappt (fast) einwandfrei deine Lösung, auch mit den Frames. Lediglich z.B. Labels die ich im Frame definiere, und dessen Eingesnschaft ich auf Transparent setzte, werden trotzdem nicht transparent dargestellt. Ist in meinem Fall jedoch nicht von Bedeutung.

Danke nochmal,
Gruss,
Tom