Re: Outlook Custom form - resize event handling

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks for prompt response!
I'm using add-in already. Yes, I can subscribe on Inspector.BeforeSize event
but it's pretty much useless for me.
Is Inspector represents the message window itself? Then I'll try to add a
hook on the form and will resize... but this mean I need to calculate
position based on Subject textbox etc... :(
--
Thanks,
VB


"Ken Slovak - [MVP - Outlook]" wrote:

Those are some of the limitations of custom forms. If you think getting the
hWnd for a custom form is bad try getting it and process/thread/window
ownership for a WordMail Inspector window.

Most ActiveX controls placed on a form only will fire their Click events,
despite whatever other events they might expose. There's an
Inspector.BeforeSize event, but you can't subscribe to that in form code.

What I usually do is to first of all avoid custom forms unless absolutely
necessary due to their limitations and frailty. If they are unavoidable I
pair them with a COM addin. If I can I just use an addin and a custom form
from there, possibly called up from an Inspector button created and
monitored by the addin.

Back to your problem. I would use an addin to monitor Inspector.Resize for
all open items in which you are interested. When that event fires I'd read
the new size and access the form control and resize it, dimensions based on
the new Inspector size.

See http://www.outlookcode.com/d/forms.htm for lots of form design
information.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"VB3T" <VB3T@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:96F568E2-1A0B-4770-B613-A7457F681B2E@xxxxxxxxxxxxxxxx
Hi all,

I used standard Message template and added custom control (RTF editor) on
the form. I want to make that control resizes when user resizes the new
message window (similar to standard Message textbox).
I hid the standard message textbox and added code in Item_Open() to make
my
control overlap original - so initial size and position are correct (see
code
below). And I checked the box 'resize with form' for the new control.
However, only control's width got resized with form but its height
remained
the same.

Sub Item_Open()
Dim oPage
Dim oTIS, oOld
Set oPage = Item.GetInspector.ModifiedFormPages(1)
Set oTIS = oPage.Controls(oPage.Controls.Count - 1) ' custom control is
the last one
Set oOld = oPage.Controls("Message") ' original textarea
oTIS.Move oOld.Left, oOld.Top, oOld.Width, oOld.Height
Set oTIS = Nothing
Set oPage = Nothing
End Sub
To test that piece of code you can create a form and put new multiline
textbox...

As workaround I tried to add a hook on parent window and resize my control
whenever parent gets resized... More problems here:
- immediate parent gets lost when form resizing causes vertical scrollbar
disappear or appear;
- when I tried to use next parent then attempts to move
the control based on parent size (GetWindowRect) resulted in weird
positions
(and also depended on fact either scrollbar was visible or not);
- I used Spy++ trying to identify windows hierarchy and found discrepancy
between standard mail message form and customized (i.e. some 'F3 Server
600..." window etc.). It seems form customization added some additional
layers...

I believe there should be some way to overcome those issues (maybe my
control should expose some interface so it's container will resize it
properly?)

Any help is highly appreciated!
--
Thanks,
VB


.



Relevant Pages

  • Re: WMP control resizing
    ... > getting the WMP9 activex control in a window and playing movies etc. ... when you want to resize the control in MFC, ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Setwindowpos()-problem.Moving control is not happening.
    ... For this i need to resize and reposition the ... I am calling GetWindowRect to get the control ... >dimensions and after changing them i am trying to call SetWindowPos() ... if onlyresize means the window is ...
    (microsoft.public.vc.mfc)
  • Re: Outlook Custom form - resize event handling
    ... to get its size and resize my control. ... ownership for a WordMail Inspector window. ... What I usually do is to first of all avoid custom forms unless absolutely ...
    (microsoft.public.office.developer.com.add_ins)
  • Re: repainting own panel-component
    ... >> three seconds have passed and that the control needs to be repainted. ... the load when the window is being resized. ... When a resize operation ... stripes remains constant and they get thicker when the control grows, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Outlook Custom form - resize event handling
    ... An Inspector is the window used to display Outlook items. ... When that event fires the window is about to be resized. ... hook on the form and will resize... ...
    (microsoft.public.office.developer.com.add_ins)