2010-11-22 2 views
4

Delphi 2010 또는 XE Application.MainFormOnTaskbar가 true로 설정된 경우 모든 보조 양식이 항상 기본 창 앞에 있습니다. Popupmode 또는 PopupParent 속성이 설정된 대상은 중요하지 않습니다. 그러나 기본 양식 뒤에 표시 할 수있는 보조 창이 있습니다.기본 폼 뒤에 Delphi 보조 양식을 허용하는 방법

MainFormOnTaskbar를 false로 설정하면 작동하지만 Windows 7 기능이 손상됩니다 (Alt-tab, Windows 표시 줄 아이콘 등).

보조 양식을 기본 양식 뒤에 숨기면서도 Windows 7 기능을 계속 사용하려면 어떻게해야합니까?

답변

4

기본적으로 할 수 없습니다. MainFormOnTaskBar의 요점은 Vista 호환성을 갖는 것입니다. 설정하지 않으면 호환성이 없어집니다. 설정하면 Z 순서가 완료됩니다. 다음 발췌 D2007의 추가 정보에서입니다 :

The property controls how Window's TaskBar buttons are handled by VCL. This property can be applied to older applications, but it affects the Z-order of your MainForm, so you should ensure that you have no dependencies on the old behavior.


를하지만 똑같은 문제를 설명하는이 QC report를 참조하십시오 (및 을 AsDesigned로 폐쇄). 이 보고서는 을 '0'으로 설정하는 양식의 CreateParams을 재정의하는 방법을 설명합니다. 또한이 해결 방법으로 인해 발생하는 몇 가지 문제점과 가능한 해결 방법에 대해서도 설명합니다. 모든 합병증을 발견하고 해결하는 것이 쉽지는 않을 것입니다. 참여할 수있는 느낌을 가지려면 Steve Trefethen의 article을 참조하십시오.

+2

언급 문서 지금 [여기 (http://www.stevetrefethen.com/blog/the-new-vcl-property-tapplication-mainformontaskbar-in-delphi-2007). –

0
나는 한 가지 방법은 다음과 같은 목적으로 제공하는 "무대 뒤의"기본 폼이하는 것이라고 생각했을 것이다

:

  1. 선택과 같은 다른 형태 중 하나를 표시하려면를 메인 폼을 만든 다음 끊임없이 숨기기 (Visible : = FALSE) 좋은 구식 "플래시"스크린처럼.

  2. 기본 양식으로 선택한 양식을 닫을 때 응용 프로그램 종료 자 역할을 수행합니다 (적절한 OnClose 이벤트 연결).

  3. 숨겨진 실제 주 양식이 "의사 주 양식"이 아닌 다른 양식의 "소유자"가되도록 지정된 의사 주 양식을 대신하여 다른 양식을여십시오. 모든 다른 양식에 '비'팝업 스타일이 있고 ShowModal이 아닌 Show (쇼) 호출을 통해 표시되는 경우이 작업이 수행됩니다.

이렇게 응용 프로그램의 동작을 약간 재구성하면 원하는 종류의 사용자 상호 작용을 얻을 수 있습니다.

unit FlashForm; 
interface 

uses 
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls; 

type 
    TFlash = class(TForm) 
    lblTitle: TLabel; 
    lblCopyright: TLabel; 
    Timer1: TTimer; 
    procedure FormCreate(Sender: TObject); 
    procedure Timer1Timer(Sender: TObject); 
    public 
    procedure CloseApp; 
    end; 

var 
    Flash: TFlash; 

implementation 

{$R *.dfm} 

uses Main; 

procedure TFlash.CloseApp; // Call this from the Main.Form1.OnClose or CanClose (OnFormCloseQuery) event handlers 
begin 
    close 
end; 

procedure TFlash.FormCreate(Sender: TObject); // You can get rid of the standard border icons if you want to 
begin 
    lblCopyright.Caption := 'Copyright (c) 2016 AT Software Engineering Ltd'; 
    Refresh; 
    Show; 
    BringToFront; 
end; 


procedure TFlash.Timer1Timer(Sender: TObject); 
begin 
    Application.MainFormOnTaskBar := FALSE; // This keeps the taskbar icon alive 
    if assigned(Main.MainForm) then 
    begin 
     visible := FALSE; 
     Main.MainForm.Show; 
     Timer1.Enabled := FALSE; 
    end else Timer1.Interval := 10; // The initial time is longer than this (flash showing time) 
end; 

end. 

// Finally, make this the FIRST form created by the application in the project file. 
관련 문제