[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

RE: setup page margins in wordpag

jimmyzh

10/7/2003 3:43:00 AM

You can use the PAGESETUPDLG structure to set the specified margin and show
page setup dialog using PageSetupDlg() API. If PSD_MARGINS is not set in
the Flags of PAGESETUPDLG structure, the system sets the initial widths to
one inch for all margins. The initial margin value is hard coded and do not
saved anywhere.

For more information, please refer:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/w...
l/cerefpagesetupdlgstructure.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/w...
l/cerefpagesetupdlg.asp

Jimmy Zhu
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

3 Answers

Marijan

10/7/2003 6:38:00 AM

0

Hi Jimmy

Thanks for the links.

Are there any examples to use PAGESETUPDLG structure and
the PageSetupDlg() API with C# under Compact Framework?

Marijan Durdek

>-----Original Message-----
>You can use the PAGESETUPDLG structure to set the
specified margin and show
>page setup dialog using PageSetupDlg() API. If
PSD_MARGINS is not set in
>the Flags of PAGESETUPDLG structure, the system sets the
initial widths to
>one inch for all margins. The initial margin value is
hard coded and do not
>saved anywhere.
>
>For more information, please refer:
>http://msdn.microsoft.com/library/de...
url=/library/en-us/wceui40/htm
>l/cerefpagesetupdlgstructure.asp
>http://msdn.microsoft.com/library/de...
url=/library/en-us/wceui40/htm
>l/cerefpagesetupdlg.asp
>
>Jimmy Zhu
>Microsoft Online Partner Support
>Get Secure! - www.microsoft.com/security
>This posting is provided "as is" with no warranties and
confers no rights.
>
>.
>

jimmyzh

10/8/2003 10:37:00 AM

0

I'm afraid that you can't use the PageSetupDialog under Compact Framework,
since PageSetupDialog, PrintPreviewDialog, and PrintDialog are not
supported by .NET Compact Framework. You can write native code using the
PageSetupDlg() API.

Jimmy Zhu
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

jimmyzh

10/14/2003 6:08:00 AM

0

Hi Marijan,

Here are some code sample for launching the dialog with the margin size you
want to set. You can write native code as below to launch the Page Setup
Dialog:

PAGESETUPDLG pageSetupDlg;
BOOL ret;
POINT pt = {0, 0};
RECT margin = {3, 3, 3, 3};
RECT minmargin = {1, 1, 1, 1};

pageSetupDlg.lStructSize = sizeof(PAGESETUPDLG);
pageSetupDlg.hwndOwner = hWnd;
pageSetupDlg.hDevMode = NULL;
pageSetupDlg.hDevNames = NULL;
pageSetupDlg.Flags = PSD_MARGINS | PSD_INTHOUSANDTHSOFINCHES;
pageSetupDlg.ptPaperSize = pt;
pageSetupDlg.rtMinMargin = minmargin;
pageSetupDlg.rtMargin = margin;
pageSetupDlg.hInstance = NULL;
pageSetupDlg.lCustData = 0;
pageSetupDlg.lpfnPageSetupHook = NULL;
pageSetupDlg.lpfnPagePaintHook = NULL;
pageSetupDlg.lpPageSetupTemplateName = NULL;
pageSetupDlg.hPageSetupTemplate = NULL;

ret = PageSetupDlg(&pageSetupDlg);

The margins are set to 3 inches each. And you can change the margin
variable to the size you want. Hope this can help you.

Jimmy Zhu
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.