How to get the size of option page

Add-in Express™ Support Service
That's what is more important than anything else

How to get the size of option page
 
Thomas Grossen


Guest


Hi,

I have found that the size of Option Pages in Outlook depend on localization and version of Outlook.

Is there any way to get the size of the option pages at run time in order to adjust my add-in page?

Thank you.
Posted 28 Dec, 2006 11:40:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Thomas.

Yes, it is possible. You just need to override the OnResize protected method of the property page class.



P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 28 Dec, 2006 12:01:11 Top
Thomas Grossen


Guest


Hi Sergey,

Yes ok, but how do I now the size "available" in the option pages window?

I mean I have no idea of the size because it depends on the localization.
Posted 28 Dec, 2006 12:46:14 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Thomas,

See the code below:


type
  TMyOptionsPage = class(TActiveForm, IMyOptionsPage, PropertyPage)
  private
    FLock: boolean;
    // ...
    [B]procedure WMPaint(var Message: TWMPaint); message WM_PAINT;[/B]
  protected
    // ...
  end;

implementation

// ...

procedure TMyOptionsPage.WMPaint(var Message: TWMPaint);
var
  ParentHWND: HWND;
  ParentRect: TRect;
begin
  inherited;
  if not FLock then begin
    FLock := True;
    try
      ParentHWND := GetParent(Self.Handle);
      Windows.GetWindowRect(ParentHWND, ParentRect);
      ParentRect.Right := ParentRect.Right - ParentRect.Left;
      ParentRect.Left := 0;
      ParentRect.Bottom := ParentRect.Bottom - ParentRect.Top;
      ParentRect.Top := 0;
      if (Self.Width
<>
ParentRect.Right) then Self.Width := ParentRect.Right;
      if (Self.Height
<>
ParentRect.Bottom) then Self.Height := ParentRect.Bottom;
    finally
      FLock := False;
    end;
  end;
end;




Posted 30 Dec, 2006 09:27:06 Top
Thomas Grossen


Guest


Thank you Dmitry.

I will try this next year :).
Posted 30 Dec, 2006 11:56:13 Top
Thomas Grossen


Guest


Your solution work perfectly.

Thank you.
Posted 02 Jan, 2007 09:15:39 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Thomas,

Thank you for the notification and good luck with your project.

Posted 03 Jan, 2007 05:14:57 Top