Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Delphi und MDI und Paint

Empfohlene Antworten

Veröffentlicht

Hallo

ich habe ein MDI Fenster (Form1), in dem ich dann zwei weitere MDIChild Fenster (Form2) öffne.

Wenn ich nun per Form1.Repaint in Form2.WindowPosChange (TMessage) mache, wird

a) Canvas.FillRect(ClientRect) nicht ordentlich gezeichnet, erst wenn ich das Fenster (Form1) Maxi und dann Minimire oder umgekehrt wird der Canvas richtig gemalt.

Der Canvas wird immer vom MDIChild Fenster Left,Top aus und dann 200,300 Pixel weit gezeichnet. und nicht von 0,0 an bis Width, Height (Form1).

Wenn ich nun das MDIChild Fenster Form2 verschiebe, dann wird auch nicht die Linie so gezeichent wie sie sein soll, erst wieder beim Maxi und Miniminimiren wird odnungsgemäß gezeichnet.

Hier der Code den ich verwende:

procedure TForm1.FormPaint(Sender: TObject);

begin

if MDIChildCount > 1 then

begin

Canvas.Pen.Color := clRed;

Canvas.Brush.Color := clRed;

Canvas.FillRect(Rect(0,0,Form1.Width,Form1.Height));

1.Canvas.Pen.Color := clBlack;

Canvas.MoveTo((MDIChildren[0] as TForm2).Left-20,(MDIChildren[0] as TForm2).Top-20);

Canvas.LineTo((MDIChildren[0] as TForm2).Left-20,(MDIChildren[0] as TForm2).Top-20);

Canvas.LineTo((MDIChildren[1] as TForm2).Left-20,(MDIChildren[1] as TForm2).Top-20);

end else

begin

Canvas.Pen.Color := clRed;

Canvas.Brush.Color := clRed;

Canvas.FillRect(Rect(0,0,Form1.Width,Form1.Height));

Canvas.Pen.Color := clBlack;

Canvas.MoveTo(100,100);

Canvas.LineTo((MDIChildren[0] as TForm2).Left-20,(MDIChildren[0] as TForm2).Top-20);

end;

end;

Tform2 Klasse:

private:

procedure WMPosChange(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;

procedure TForm2.WMPosChange(var Message: TWMWindowPosChanging);

begin

// with PWindowPos(TMessage(Message).lParam)^ do

// Flags:=Flags or SWP_NOMOVE;

Form1.Repaint;

end;

Für Lösungen für dieses doofe Problem (also das ordnungsgemäße Zeichnen) bin ich euch Dankbar

Mfg

paule

Hallo,

also ich kapiere irgendwie nicht so ganz, was der Code überhaupt bewirken soll. Was sollte den eigentlich rauskommen?

Hallo,

also es sollen 2 oder mehrere MDIChild Forms angezeigt werden (innerhalb einer MDIForm). dann sollen die Fenster mit Linien verbunden werden - so wie man das bei Access her kennt (Beziehungen).

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.