设置为自动隐藏我的窗口设置为最大化时,任务栏消失

时间:2012-10-24 08:46:03

标签: delphi windows-7

我将Windows任务栏设置为自动隐藏 当我将我的应用程序设置为最大化时,底部任务栏的小2像素lignes消失,我无法访问任务栏后 如果我最小化我的应用程序,任务栏重新出现。

你知道为什么吗?

我在Windows 7下 我的应用程序是用Delphi XE编程的

要制作一个chrome / firefox之类的应用程序,顶部有标签。 我给你一个带有消失任务栏问题的样本:

DFM

object Form3: TForm3
  Left = 0
  Top = 0
  Caption = 'Form3'
  ClientHeight = 320
  ClientWidth = 635
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Arial'
  Font.Style = []
  OldCreateOrder = False
  WindowState = wsMaximized
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 14
  object PageControl1: TPageControl
    AlignWithMargins = True
    Left = 0
    Top = 15
    Width = 635
    Height = 305
    Margins.Left = 0
    Margins.Top = 15
    Margins.Right = 0
    Margins.Bottom = 0
    ActivePage = TabSheet3
    Align = alClient
    TabOrder = 0
    object TabSheet1: TTabSheet
      Caption = 'TabSheet1'
    end
    object TabSheet2: TTabSheet
      Caption = 'TabSheet2'
    end
    object TabSheet3: TTabSheet
      Caption = 'TabSheet3'
    end
  end
end

代码

unit Unit3;

interface

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

type
  TForm3 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    procedure FormCreate(Sender: TObject);
  private
    FWndTopFrameSize : Integer;
    FWndBorderFrameSize : Integer;
    procedure WMNCCalcSize(var Message: TWMNCCalcSize); message WM_NCCALCSIZE;
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.FormCreate(Sender: TObject);
var
   r : TRect;
begin
   if DwmCompositionEnabled then begin
      SetRectEmpty(r);
      AdjustWindowRectEx(r, GetWindowLong(Handle, GWL_STYLE), False,
                         GetWindowLong(Handle, GWL_EXSTYLE));
      FWndTopFrameSize:=-r.Top;
      FWndBorderFrameSize:=r.Right;
      GlassFrame.Top:=FWndTopFrameSize+PageControl1.Margins.Top;
      GlassFrame.Enabled:=True;
      SetWindowPos(Handle, 0, Left, Top, Width, Height, SWP_FRAMECHANGED);
   end;
end;

procedure TForm3.WMNCCalcSize(var Message: TWMNCCalcSize);
begin
   inherited;
   if DwmCompositionEnabled then
      Inc(Message.CalcSize_Params.rgrc[0].Top, -FWndTopFrameSize);
end;

end.

0 个答案:

没有答案