AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

MessageBox Postion

Ein Thema von SaFu · begonnen am 25. Feb 2008 · letzter Beitrag vom 26. Feb 2008
 
Benutzerbild von Dani
Dani

Registriert seit: 19. Jan 2003
732 Beiträge
 
Turbo Delphi für Win32
 
#9

Re: MessageBox Postion

  Alt 25. Feb 2008, 22:03
Delphi-Quellcode:
function MessageDlgPos2(const Msg: string; DlgType: TMsgDlgType;
  Buttons: TMsgDlgButtons; ParentForm: TForm = nil; HelpCtx: Longint = -1;
  const HelpFileName: string = ''): Integer;
begin
  with CreateMessageDialog(Msg, DlgType, Buttons) do
    try
      HelpContext := HelpCtx;
      HelpFile := HelpFileName;
      if Assigned(ParentForm) then begin
        Position := poDesigned;
        //0 div 2 -> 0, also kein Problem.
        Left := ParentForm.Left + ((ParentForm.Width - Width) div 2);
        Top := ParentForm.Top + ((ParentForm.Height - Height) div 2);
      end else begin
        Position := poScreenCenter;
      end;
      Result := ShowModal;
    finally
      Free;
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  MessageDlgPos2('Dies ist ein Test', mtInformation, [mbOK], Self);
end;
Wäre vielleicht noch ganz gut zu prüfen, ob der Dialog überhaupt auf einem Bildschirm sichtbar ist und ihn dann ggf zu verschieben.
Dani H.
At Least I Can Say I Tried
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:31 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz