Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Form immer innerhalb vom bildschirm rand (https://www.delphipraxis.net/26905-form-immer-innerhalb-vom-bildschirm-rand.html)

ArmyMan 31. Jul 2004 11:12


Form immer innerhalb vom bildschirm rand
 
Wie kann ich machen dass mein programm immer im bildschirm rand bleibt. Sowie Pinnacle PCTV falls jemand dass kennt.

Thx ArmyMan

DP-Maintenance 31. Jul 2004 11:20

DP-Maintenance
 
Dieses Thema wurde von "Sharky" von "Neuen Beitrag zur Code-Library hinzufügen" nach "VCL-Komponenten und Controls" verschoben.
Ist kein Beitrag zur CodeLib sondern eine Frage ;-)

ArmyMan 31. Jul 2004 11:46

Re: Form immer innerhalb vom bildschirm rand
 
Kann mir jemand helfen? Ich habe gesucht aber nichts gefunden. Wäre froh wenn jemand helfen kann.

Thx ArmyMan

Chris1986 31. Jul 2004 12:20

Re: Form immer innerhalb vom bildschirm rand
 
Hi.
vergleich doch einfach die Größe deiner Form mit der Größe des "Screens"

Gruß
Christian

nailor 31. Jul 2004 12:24

Re: Form immer innerhalb vom bildschirm rand
 
das form kann ja auch kleiner sein, es soll nur nicht rausgucken. eventuell kannst du ja schaun ob

left < 0
left + widht > screen.widht
top < 0
top + height > screen.height

NicoDE 31. Jul 2004 13:41

Re: Form immer innerhalb vom bildschirm rand
 
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TWmMoving = record
    uMsg : UINT;
    wParam: WPARAM;
    lParam: ^TRect;
    Result: HRESULT;
  end;

type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
    procedure WmMoving(var Message: TWmMoving); message WM_MOVING;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WmMoving(var Message: TWmMoving);
var
  WorkArea: TRect;
begin
  inherited;
  if SystemParametersInfo(SPI_GETWORKAREA, 0, @WorkArea, 0) then
    with Message do
    begin
      if lParam.Right > WorkArea.Right then
        OffsetRect(lParam^, WorkArea.Right - lParam.Right, 0);
      if lParam.Left < WorkArea.Left then
        OffsetRect(lParam^, WorkArea.Left - lParam.Left, 0);
      if lParam.Bottom > WorkArea.Bottom then
        OffsetRect(lParam^, 0, WorkArea.Bottom - lParam.Bottom);
      if lParam.Top < WorkArea.Top then
        OffsetRect(lParam^, 0, WorkArea.Top - lParam.Top);
      Result := HRESULT(True);
    end;
end;

end.

ArmyMan 31. Jul 2004 16:07

Re: Form immer innerhalb vom bildschirm rand
 
Perfect! Super!

Genau das ist was ich brauchte.

Thx a lot :-)

ArmyMan


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz