A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to set control position in outlook property page?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 20th 09, 03:53 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to set control position in outlook property page?

My environment is VC++2005/ATL/OLK2003&2007. I added Outlook::
ApplicationEvents successfully and all are ok. But the size of propertypage
for outlook2003 and 2007 is different, so i want to adjust the controls'
position to the middle of the propertypage. But it is no use to call
SetWindowPos or MoveWindow in OnInitDialog function, what should i do? I have
a lot of controls on the propertypage.
LRESULT CPropPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled)
{
// TODO : Add Code for message handler. Call DefWindowProc if necessary.
GetDlgItem(IDC_STATIC_PROPAGE).SetFont(HFONT(boldF ont_));
SetTimer(FreshGUI, 1000, NULL);

//set the window position, can't take effort, why??
m_Control = GetParent();
CRect ParentRc, CurRc;
int xCord = 0, yCord = 0;
m_Control.GetClientRect(ParentRc);
GetWindowRect(CurRc);
xCord = (ParentRc.Width()-CurRc.Width())/2;
yCord = (ParentRc.Height()-CurRc.Height())/2;
SetWindowPos(HWND_TOP, xCord, yCord, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);

return 0;
}

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200901/1

Ads
  #2  
Old January 20th 09, 01:56 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to set control position in outlook property page?

About the best way I've found is just to get the normal sizes for both
versions and set up your code based on that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:9072cd87988d5@uwe...
My environment is VC++2005/ATL/OLK2003&2007. I added Outlook::
ApplicationEvents successfully and all are ok. But the size of
propertypage
for outlook2003 and 2007 is different, so i want to adjust the controls'
position to the middle of the propertypage. But it is no use to call
SetWindowPos or MoveWindow in OnInitDialog function, what should i do? I
have
a lot of controls on the propertypage.
LRESULT CPropPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled)
{
// TODO : Add Code for message handler. Call DefWindowProc if
necessary.
GetDlgItem(IDC_STATIC_PROPAGE).SetFont(HFONT(boldF ont_));
SetTimer(FreshGUI, 1000, NULL);

//set the window position, can't take effort, why??
m_Control = GetParent();
CRect ParentRc, CurRc;
int xCord = 0, yCord = 0;
m_Control.GetClientRect(ParentRc);
GetWindowRect(CurRc);
xCord = (ParentRc.Width()-CurRc.Width())/2;
yCord = (ParentRc.Height()-CurRc.Height())/2;
SetWindowPos(HWND_TOP, xCord, yCord, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);

return 0;
}

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200901/1


  #3  
Old January 21st 09, 02:17 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to set control position in outlook property page?

Hi, Ken, thank you for your reply. The size, Do you mean the fixed pixels
which defined by outlook itself? 2007 is 473*440(include propertypage header)
and 2003 is 421*398. No matter what the resolution ratio is, it is not change.

The follow code can get this size(rectangle):
m_Control = GetParent();
CRect ParentRc, CurRc;
int xCord = 0, yCord = 0;
m_Control.GetClientRect(ParentRc);
GetWindowRect(CurRc);
How do i change the position? Could you please explain that more detailed?
Thanks very much.

Ken Slovak - [MVP - Outlook] wrote:
About the best way I've found is just to get the normal sizes for both
versions and set up your code based on that.


--
Message posted via http://www.officekb.com

  #4  
Old January 21st 09, 02:20 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to set control position in outlook property page?

Once you have the sizes of the windows you can do one of two things. You can
just design your property page so it looks OK no matter which version of
Outlook is running. Or you can set up ratios of where each control is
related to the overall window size you have to work with. Then you would
move your controls based on the Outlook version. I usually just use a size
of 421 x 398 and place my controls based on that and leave white space if a
larger canvas is available.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:907e894213b70@uwe...
Hi, Ken, thank you for your reply. The size, Do you mean the fixed pixels
which defined by outlook itself? 2007 is 473*440(include propertypage
header)
and 2003 is 421*398. No matter what the resolution ratio is, it is not
change.

The follow code can get this size(rectangle):
m_Control = GetParent();
CRect ParentRc, CurRc;
int xCord = 0, yCord = 0;
m_Control.GetClientRect(ParentRc);
GetWindowRect(CurRc);
How do i change the position? Could you please explain that more detailed?
Thanks very much.

Ken Slovak - [MVP - Outlook] wrote:
About the best way I've found is just to get the normal sizes for both
versions and set up your code based on that.


--
Message posted via http://www.officekb.com


  #5  
Old January 23rd 09, 05:24 AM posted to microsoft.public.outlook.program_addins
ryotyankou via OfficeKB.com
external usenet poster
 
Posts: 101
Default How to set control position in outlook property page?

I am not exactly understand your meaning, would you please show me some code
Snippets, or just Pseudocode? Thank you.

Ken Slovak - [MVP - Outlook] wrote:
Once you have the sizes of the windows you can do one of two things. You can
just design your property page so it looks OK no matter which version of
Outlook is running. Or you can set up ratios of where each control is
related to the overall window size you have to work with. Then you would
move your controls based on the Outlook version. I usually just use a size
of 421 x 398 and place my controls based on that and leave white space if a
larger canvas is available.

Hi, Ken, thank you for your reply. The size, Do you mean the fixed pixels
which defined by outlook itself? 2007 is 473*440(include propertypage

[quoted text clipped - 13 lines]
About the best way I've found is just to get the normal sizes for both
versions and set up your code based on that.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200901/1

  #6  
Old January 23rd 09, 02:12 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to set control position in outlook property page?

Say Control1 is at the top left of the window at a position 5% below the top
of the window and 5% from the left. If the dimensions are 421x398 then you
take 5% of those dimensions in each dimension and move your control there.
Repeat for all other controls. Same thing for any other size window.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:90995163a676c@uwe...
I am not exactly understand your meaning, would you please show me some
code
Snippets, or just Pseudocode? Thank you.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook View Control Folder property Nency Add-ins for Outlook 2 October 6th 08 12:34 PM
Get the Position of Outlook 2007 Control relative to screen n777krish Outlook and VBA 3 November 27th 07 02:02 PM
Changing property of control to all caps Russ Outlook - Using Forms 10 June 29th 06 04:21 PM
Background Color for Outlook Property Page paulmcd Add-ins for Outlook 2 February 15th 06 07:38 AM
why can't you add a page to a form just like you can add a page to the property page donald Outlook - Using Forms 2 January 25th 06 10:50 AM


All times are GMT +1. The time now is 09:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.