home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / Chip_2002-09_cd1.bin / zkuste / vbasic / Data / Utils / glm2demo.exe / %MAINDIR% / CommonDialog / PageSetp.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-06-10  |  29.7 KB  |  857 lines

  1. VERSION 5.00
  2. Begin VB.Form PageSetupForm 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Page Setup example"
  5.    ClientHeight    =   5745
  6.    ClientLeft      =   45
  7.    ClientTop       =   360
  8.    ClientWidth     =   9735
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   5745
  13.    ScaleWidth      =   9735
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.ListBox List1 
  16.       Height          =   2595
  17.       ItemData        =   "PageSetp.frx":0000
  18.       Left            =   4440
  19.       List            =   "PageSetp.frx":002E
  20.       MultiSelect     =   1  'Simple
  21.       TabIndex        =   54
  22.       Top             =   445
  23.       Width           =   2640
  24.    End
  25.    Begin VB.Frame Frame2 
  26.       Caption         =   "Dialog Box Position"
  27.       BeginProperty Font 
  28.          Name            =   "MS Sans Serif"
  29.          Size            =   8.25
  30.          Charset         =   0
  31.          Weight          =   700
  32.          Underline       =   0   'False
  33.          Italic          =   0   'False
  34.          Strikethrough   =   0   'False
  35.       EndProperty
  36.       Height          =   1440
  37.       Left            =   120
  38.       TabIndex        =   47
  39.       Top             =   1600
  40.       Width           =   4215
  41.       Begin VB.TextBox YPosText 
  42.          Height          =   345
  43.          Left            =   2880
  44.          TabIndex        =   51
  45.          Text            =   "0"
  46.          Top             =   990
  47.          Width           =   555
  48.       End
  49.       Begin VB.TextBox XPosText 
  50.          Height          =   345
  51.          Left            =   1380
  52.          TabIndex        =   50
  53.          Text            =   "0"
  54.          Top             =   990
  55.          Width           =   555
  56.       End
  57.       Begin VB.CheckBox SetDlgPosToScreenCheck 
  58.          Caption         =   "Set Dialog &Position Relative To Screen"
  59.          Height          =   285
  60.          Left            =   360
  61.          TabIndex        =   49
  62.          Top             =   630
  63.          Width           =   3075
  64.       End
  65.       Begin VB.CheckBox SetDlgPosCheck 
  66.          Caption         =   "Set &Dialog Position"
  67.          Height          =   285
  68.          Left            =   120
  69.          TabIndex        =   48
  70.          Top             =   240
  71.          Width           =   1845
  72.       End
  73.       Begin VB.Label Label2 
  74.          Caption         =   "&Y Position"
  75.          Height          =   225
  76.          Left            =   2040
  77.          TabIndex        =   53
  78.          Top             =   1050
  79.          Width           =   735
  80.       End
  81.       Begin VB.Label Label1 
  82.          Caption         =   "&X Position"
  83.          Height          =   225
  84.          Left            =   540
  85.          TabIndex        =   52
  86.          Top             =   1050
  87.          Width           =   765
  88.       End
  89.    End
  90.    Begin VB.Frame Frame4 
  91.       Caption         =   "Paper Information"
  92.       BeginProperty Font 
  93.          Name            =   "MS Sans Serif"
  94.          Size            =   8.25
  95.          Charset         =   0
  96.          Weight          =   700
  97.          Underline       =   0   'False
  98.          Italic          =   0   'False
  99.          Strikethrough   =   0   'False
  100.       EndProperty
  101.       Height          =   1005
  102.       Left            =   120
  103.       TabIndex        =   44
  104.       Top             =   4650
  105.       Width           =   5175
  106.       Begin VB.ComboBox PaperSourceCombo 
  107.          Height          =   315
  108.          Left            =   1200
  109.          Style           =   2  'Dropdown List
  110.          TabIndex        =   28
  111.          Top             =   600
  112.          Width           =   3825
  113.       End
  114.       Begin VB.ComboBox PaperSizeCombo 
  115.          Height          =   315
  116.          Left            =   1200
  117.          Style           =   2  'Dropdown List
  118.          TabIndex        =   27
  119.          Top             =   240
  120.          Width           =   3825
  121.       End
  122.       Begin VB.Label Label11 
  123.          Caption         =   "Paper Source"
  124.          Height          =   195
  125.          Index           =   3
  126.          Left            =   120
  127.          TabIndex        =   46
  128.          Top             =   640
  129.          Width           =   975
  130.       End
  131.       Begin VB.Label Label11 
  132.          Caption         =   "Paper Size"
  133.          Height          =   195
  134.          Index           =   2
  135.          Left            =   120
  136.          TabIndex        =   45
  137.          Top             =   300
  138.          Width           =   765
  139.       End
  140.    End
  141.    Begin VB.Frame Frame5 
  142.       Caption         =   "Minim&um Margin Setup"
  143.       BeginProperty Font 
  144.          Name            =   "MS Sans Serif"
  145.          Size            =   8.25
  146.          Charset         =   0
  147.          Weight          =   700
  148.          Underline       =   0   'False
  149.          Italic          =   0   'False
  150.          Strikethrough   =   0   'False
  151.       EndProperty
  152.       Height          =   1215
  153.       Left            =   7200
  154.       TabIndex        =   8
  155.       Top             =   2280
  156.       Width           =   2415
  157.       Begin VB.TextBox TopMinMarginText 
  158.          Height          =   285
  159.          Left            =   480
  160.          TabIndex        =   11
  161.          Top             =   750
  162.          Width           =   495
  163.       End
  164.       Begin VB.TextBox RightMinMarginText 
  165.          Height          =   285
  166.          Left            =   1740
  167.          TabIndex        =   10
  168.          Top             =   330
  169.          Width           =   495
  170.       End
  171.       Begin VB.TextBox LeftMinMarginText 
  172.          Height          =   285
  173.          Left            =   480
  174.          TabIndex        =   9
  175.          Top             =   330
  176.          Width           =   495
  177.       End
  178.       Begin VB.TextBox BottomMinMarginText 
  179.          Height          =   285
  180.          Left            =   1740
  181.          TabIndex        =   12
  182.          Top             =   750
  183.          Width           =   495
  184.       End
  185.       Begin VB.Label Label4 
  186.          Caption         =   "Bottom"
  187.          Height          =   195
  188.          Index           =   0
  189.          Left            =   1170
  190.          TabIndex        =   39
  191.          Top             =   780
  192.          Width           =   495
  193.       End
  194.       Begin VB.Label Label9 
  195.          Caption         =   "Left"
  196.          Height          =   195
  197.          Index           =   0
  198.          Left            =   120
  199.          TabIndex        =   38
  200.          Top             =   360
  201.          Width           =   270
  202.       End
  203.       Begin VB.Label Label11 
  204.          Caption         =   "Right"
  205.          Height          =   195
  206.          Index           =   0
  207.          Left            =   1170
  208.          TabIndex        =   37
  209.          Top             =   360
  210.          Width           =   375
  211.       End
  212.       Begin VB.Label Label12 
  213.          Caption         =   "Top"
  214.          Height          =   195
  215.          Index           =   0
  216.          Left            =   120
  217.          TabIndex        =   36
  218.          Top             =   780
  219.          Width           =   285
  220.       End
  221.    End
  222.    Begin VB.Frame Frame9 
  223.       Caption         =   "Other Options"
  224.       BeginProperty Font 
  225.          Name            =   "MS Sans Serif"
  226.          Size            =   8.25
  227.          Charset         =   0
  228.          Weight          =   700
  229.          Underline       =   0   'False
  230.          Italic          =   0   'False
  231.          Strikethrough   =   0   'False
  232.       EndProperty
  233.       Height          =   2055
  234.       Left            =   7200
  235.       TabIndex        =   35
  236.       Top             =   120
  237.       Width           =   2415
  238.       Begin VB.TextBox PageSetupCaptionText 
  239.          Height          =   315
  240.          Left            =   180
  241.          TabIndex        =   56
  242.          Text            =   "Custom Page Setup"
  243.          Top             =   720
  244.          Width           =   1935
  245.       End
  246.       Begin VB.CheckBox RaiseEventCheck 
  247.          Caption         =   "Raise Callback &Event"
  248.          Height          =   285
  249.          Left            =   180
  250.          TabIndex        =   6
  251.          Top             =   1200
  252.          Width           =   1875
  253.       End
  254.       Begin VB.CheckBox DisablePagePaintCheck 
  255.          Caption         =   "Disable Pa&ge Painting"
  256.          Height          =   315
  257.          Left            =   180
  258.          TabIndex        =   7
  259.          Top             =   1560
  260.          Width           =   1875
  261.       End
  262.       Begin VB.Label Label5 
  263.          Caption         =   "Page Setup Dialog Caption:"
  264.          Height          =   255
  265.          Left            =   180
  266.          TabIndex        =   57
  267.          Top             =   480
  268.          Width           =   2055
  269.       End
  270.    End
  271.    Begin VB.Frame Frame8 
  272.       Caption         =   "Page Orientation"
  273.       BeginProperty Font 
  274.          Name            =   "MS Sans Serif"
  275.          Size            =   8.25
  276.          Charset         =   0
  277.          Weight          =   700
  278.          Underline       =   0   'False
  279.          Italic          =   0   'False
  280.          Strikethrough   =   0   'False
  281.       EndProperty
  282.       Height          =   1005
  283.       Left            =   5400
  284.       TabIndex        =   29
  285.       Top             =   4650
  286.       Width           =   1695
  287.       Begin VB.OptionButton LandscapeOpt 
  288.          Caption         =   "L&andscape"
  289.          Height          =   255
  290.          Left            =   240
  291.          TabIndex        =   31
  292.          Top             =   600
  293.          Width           =   1100
  294.       End
  295.       Begin VB.OptionButton PortraitOpt 
  296.          Caption         =   "Por&trait"
  297.          Height          =   255
  298.          Left            =   240
  299.          TabIndex        =   30
  300.          Top             =   240
  301.          Value           =   -1  'True
  302.          Width           =   1000
  303.       End
  304.    End
  305.    Begin VB.Frame Frame7 
  306.       Caption         =   "&Margin Setup"
  307.       BeginProperty Font 
  308.          Name            =   "MS Sans Serif"
  309.          Size            =   8.25
  310.          Charset         =   0
  311.          Weight          =   700
  312.          Underline       =   0   'False
  313.          Italic          =   0   'False
  314.          Strikethrough   =   0   'False
  315.       EndProperty
  316.       Height          =   1280
  317.       Left            =   7200
  318.       TabIndex        =   13
  319.       Top             =   3600
  320.       Width           =   2415
  321.       Begin VB.TextBox BottomMarginText 
  322.          Height          =   285
  323.          Left            =   1740
  324.          TabIndex        =   17
  325.          Top             =   780
  326.          Width           =   495
  327.       End
  328.       Begin VB.TextBox LeftMarginText 
  329.          Height          =   285
  330.          Left            =   480
  331.          TabIndex        =   14
  332.          Top             =   300
  333.          Width           =   495
  334.       End
  335.       Begin VB.TextBox RightMarginText 
  336.          Height          =   285
  337.          Left            =   1740
  338.          TabIndex        =   15
  339.          Top             =   300
  340.          Width           =   495
  341.       End
  342.       Begin VB.TextBox TopMarginText 
  343.          Height          =   285
  344.          Left            =   480
  345.          TabIndex        =   16
  346.          Top             =   780
  347.          Width           =   495
  348.       End
  349.       Begin VB.Label Label12 
  350.          Caption         =   "Top"
  351.          Height          =   195
  352.          Index           =   1
  353.          Left            =   120
  354.          TabIndex        =   43
  355.          Top             =   810
  356.          Width           =   285
  357.       End
  358.       Begin VB.Label Label11 
  359.          Caption         =   "Right"
  360.          Height          =   195
  361.          Index           =   1
  362.          Left            =   1170
  363.          TabIndex        =   42
  364.          Top             =   330
  365.          Width           =   375
  366.       End
  367.       Begin VB.Label Label9 
  368.          Caption         =   "Left"
  369.          Height          =   195
  370.          Index           =   1
  371.          Left            =   120
  372.          TabIndex        =   41
  373.          Top             =   330
  374.          Width           =   270
  375.       End
  376.       Begin VB.Label Label4 
  377.          Caption         =   "Bottom"
  378.          Height          =   195
  379.          Index           =   1
  380.          Left            =   1170
  381.          TabIndex        =   40
  382.          Top             =   810
  383.          Width           =   495
  384.       End
  385.    End
  386.    Begin VB.Frame Frame6 
  387.       Caption         =   "Help Options"
  388.       BeginProperty Font 
  389.          Name            =   "MS Sans Serif"
  390.          Size            =   8.25
  391.          Charset         =   0
  392.          Weight          =   700
  393.          Underline       =   0   'False
  394.          Italic          =   0   'False
  395.          Strikethrough   =   0   'False
  396.       EndProperty
  397.       Height          =   1455
  398.       Index           =   1
  399.       Left            =   120
  400.       TabIndex        =   34
  401.       Top             =   3120
  402.       Width           =   6975
  403.       Begin VB.CommandButton Browse 
  404.          Caption         =   "Bro&wse..."
  405.          Height          =   375
  406.          Left            =   5520
  407.          TabIndex        =   20
  408.          Top             =   200
  409.          Width           =   1095
  410.       End
  411.       Begin VB.TextBox HelpKeyText 
  412.          Height          =   315
  413.          Left            =   2880
  414.          TabIndex        =   26
  415.          Top             =   1050
  416.          Width           =   1005
  417.       End
  418.       Begin VB.TextBox HelpContextNumberText 
  419.          Height          =   315
  420.          Left            =   2880
  421.          TabIndex        =   23
  422.          Top             =   630
  423.          Width           =   1005
  424.       End
  425.       Begin VB.OptionButton HelpKeyOpt 
  426.          Caption         =   "Help &Key"
  427.          Height          =   255
  428.          Left            =   180
  429.          TabIndex        =   24
  430.          Top             =   1080
  431.          Width           =   1245
  432.       End
  433.       Begin VB.TextBox HelpFileText 
  434.          Height          =   315
  435.          Left            =   1410
  436.          TabIndex        =   19
  437.          Top             =   210
  438.          Width           =   4005
  439.       End
  440.       Begin VB.OptionButton HelpContextOpt 
  441.          Caption         =   "Help Co&ntext"
  442.          Height          =   255
  443.          Left            =   180
  444.          TabIndex        =   21
  445.          Top             =   660
  446.          Value           =   -1  'True
  447.          Width           =   1245
  448.       End
  449.       Begin VB.Label Label8 
  450.          Caption         =   "Help Key Word"
  451.          Height          =   255
  452.          Left            =   1620
  453.          TabIndex        =   25
  454.          Top             =   1110
  455.          Width           =   1155
  456.       End
  457.       Begin VB.Label Label7 
  458.          Caption         =   "Context Number"
  459.          Height          =   255
  460.          Left            =   1620
  461.          TabIndex        =   22
  462.          Top             =   690
  463.          Width           =   1155
  464.       End
  465.       Begin VB.Label Label6 
  466.          Caption         =   "&Help File Name"
  467.          Height          =   255
  468.          Left            =   150
  469.          TabIndex        =   18
  470.          Top             =   270
  471.          Width           =   1155
  472.       End
  473.    End
  474.    Begin VB.Frame Frame3 
  475.       Caption         =   "Button Options"
  476.       BeginProperty Font 
  477.          Name            =   "MS Sans Serif"
  478.          Size            =   8.25
  479.          Charset         =   0
  480.          Weight          =   700
  481.          Underline       =   0   'False
  482.          Italic          =   0   'False
  483.          Strikethrough   =   0   'False
  484.       EndProperty
  485.       Height          =   1455
  486.       Left            =   120
  487.       TabIndex        =   33
  488.       Top             =   120
  489.       Width           =   4215
  490.       Begin VB.CheckBox CancelErrorCheck 
  491.          Caption         =   "&Raise Error On Cancel"
  492.          Height          =   285
  493.          Left            =   2130
  494.          TabIndex        =   1
  495.          Top             =   240
  496.          Width           =   1905
  497.       End
  498.       Begin VB.CheckBox HideCancelCheck 
  499.          Caption         =   "Hide Cancel &Button"
  500.          Height          =   285
  501.          Left            =   120
  502.          TabIndex        =   0
  503.          Top             =   240
  504.          Width           =   1845
  505.       End
  506.       Begin VB.CheckBox CustomButtonCaptionCheck 
  507.          Caption         =   "Change &OK Button Caption"
  508.          Height          =   285
  509.          Left            =   120
  510.          TabIndex        =   2
  511.          Top             =   660
  512.          Width           =   2865
  513.       End
  514.       Begin VB.TextBox CustomButtonCaptionText 
  515.          Height          =   345
  516.          Left            =   3060
  517.          TabIndex        =   3
  518.          Text            =   "&Select"
  519.          Top             =   630
  520.          Width           =   945
  521.       End
  522.       Begin VB.TextBox CustomCancelCaptionText 
  523.          Height          =   345
  524.          Left            =   3060
  525.          TabIndex        =   5
  526.          Text            =   "E&xit"
  527.          Top             =   1050
  528.          Width           =   945
  529.       End
  530.       Begin VB.CheckBox CustomCancelCaptionCheck 
  531.          Caption         =   "Change &Cancel Button Caption"
  532.          Height          =   285
  533.          Left            =   120
  534.          TabIndex        =   4
  535.          Top             =   1080
  536.          Width           =   2865
  537.       End
  538.    End
  539.    Begin VB.CommandButton ShowPageSetupBut 
  540.       Caption         =   "&Show Dialog!"
  541.       BeginProperty Font 
  542.          Name            =   "MS Sans Serif"
  543.          Size            =   13.5
  544.          Charset         =   0
  545.          Weight          =   700
  546.          Underline       =   0   'False
  547.          Italic          =   0   'False
  548.          Strikethrough   =   0   'False
  549.       EndProperty
  550.       Height          =   645
  551.       Left            =   7200
  552.       TabIndex        =   32
  553.       Top             =   5000
  554.       Width           =   2415
  555.    End
  556.    Begin VB.Label Label3 
  557.       AutoSize        =   -1  'True
  558.       Caption         =   "Flags:"
  559.       BeginProperty Font 
  560.          Name            =   "MS Sans Serif"
  561.          Size            =   8.25
  562.          Charset         =   0
  563.          Weight          =   700
  564.          Underline       =   0   'False
  565.          Italic          =   0   'False
  566.          Strikethrough   =   0   'False
  567.       EndProperty
  568.       Height          =   195
  569.       Left            =   4440
  570.       TabIndex        =   55
  571.       Top             =   195
  572.       Width           =   525
  573.    End
  574. Attribute VB_Name = "PageSetupForm"
  575. Attribute VB_GlobalNameSpace = False
  576. Attribute VB_Creatable = False
  577. Attribute VB_PredeclaredId = True
  578. Attribute VB_Exposed = False
  579. Option Explicit
  580. Dim WithEvents dwCmdDialog As dwPageSetup
  581. Attribute dwCmdDialog.VB_VarHelpID = -1
  582. Private Sub Browse_Click()
  583. Dim dwCmdDialog As dwFileOpenSave
  584. Dim lres As Long
  585. Dim lstr As String
  586.     Set dwCmdDialog = New dwFileOpenSave
  587.     dwCmdDialog.DialogTitle = "Select Help File"
  588.     dwCmdDialog.Filter = "Help (*.hlp)|*.hlp|All Files (*.*)|*.*"
  589.     dwCmdDialog.DlgWindowOwner = Me.hWnd
  590.     dwCmdDialog.SetDialogPosition = True
  591.     dwCmdDialog.PosX = 50
  592.     dwCmdDialog.PosY = 50
  593.     dwCmdDialog.CustomOkButtonCaption = True
  594.     dwCmdDialog.OkButtonCaption = "Select"
  595.     dwCmdDialog.Flags = glmcdOFNEnableHook Or glmcdOFNLongNames Or glmcdOFNFileMustexist Or glmcdOFNNoChangeDir Or glmcdOFNHideReadOnly
  596.     If WindowsVersion <> 35 Then
  597.         dwCmdDialog.Flags = dwCmdDialog.Flags Or glmcdOFNExplorer
  598.     End If
  599.     lres = dwCmdDialog.ShowOpen
  600.     If lres = 1 Then
  601.         HelpFileText.Text = dwCmdDialog.filename
  602.     End If
  603.     Set dwCmdDialog = Nothing
  604. End Sub
  605. Private Sub Form_Load()
  606.     If SetDlgPosCheck.Value Then
  607.         SetDlgPosToScreenCheck.Enabled = True
  608.         XPosText.Enabled = True
  609.         YPosText.Enabled = True
  610.     Else
  611.         SetDlgPosToScreenCheck.Enabled = False
  612.         XPosText.Enabled = False
  613.         YPosText.Enabled = False
  614.     End If
  615.     ' Initialize list box
  616.     List1.Selected(2) = True    ' Use "Thousands of Inch"
  617.     List1.Selected(11) = True   ' show help button
  618.     List1.Selected(13) = True   ' enable hook
  619.     FillPaperSizeList PaperSizeCombo
  620.     FillPaperSourceList PaperSourceCombo
  621. End Sub
  622. Private Sub HelpContextOpt_Click()
  623.     HelpContextNumberText.Enabled = True
  624.     HelpKeyText.Enabled = False
  625.     HelpKeyText.Text = ""
  626. End Sub
  627. Private Sub HelpKeyOpt_Click()
  628.     HelpKeyText.Enabled = True
  629.     HelpContextNumberText.Enabled = False
  630.     HelpContextNumberText.Text = ""
  631. End Sub
  632. Private Sub Option1_Click()
  633. End Sub
  634. Private Sub SetDlgPosCheck_Click()
  635.     If SetDlgPosCheck.Value Then
  636.         SetDlgPosToScreenCheck.Enabled = True
  637.         XPosText.Enabled = True
  638.         YPosText.Enabled = True
  639.     Else
  640.         SetDlgPosToScreenCheck.Enabled = False
  641.         XPosText.Enabled = False
  642.         YPosText.Enabled = False
  643.     End If
  644. End Sub
  645. Private Function GetPageSetupFlags() As Long
  646. Dim lcount As Long, lindex As Long
  647. Dim flagvalue As Long
  648.     lindex = List1.ListCount
  649.     For lcount = 0 To lindex - 1 Step 1
  650.         If List1.Selected(lcount) Then
  651.             flagvalue = flagvalue + 2 ^ lcount
  652.         End If
  653.     Next
  654.     GetPageSetupFlags = flagvalue
  655. End Function
  656. Private Sub ShowPageSetupBut_Click()
  657. Dim multiplier As Integer
  658. Dim lres As Long
  659. Dim lstr As String
  660. Dim dwCmdDialog As dwPageSetup
  661.     Set dwCmdDialog = New dwPageSetup
  662.     dwCmdDialog.DialogTitle = PageSetupCaptionText.Text
  663.     dwCmdDialog.DlgWindowOwner = Me.hWnd
  664.     dwCmdDialog.HideCancel = HideCancelCheck.Value
  665.     dwCmdDialog.SetDialogPosition = SetDlgPosCheck.Value
  666.     dwCmdDialog.SetDialogRelativeToScreen = SetDlgPosToScreenCheck.Value
  667.     dwCmdDialog.PosX = Val(XPosText.Text)
  668.     dwCmdDialog.PosY = Val(YPosText.Text)
  669.     dwCmdDialog.CustomOkButtonCaption = CustomButtonCaptionCheck.Value
  670.     dwCmdDialog.OkButtonCaption = CustomButtonCaptionText.Text
  671.     dwCmdDialog.CustomCancelButtonCaption = CustomCancelCaptionCheck.Value
  672.     dwCmdDialog.CancelButtonCaption = CustomCancelCaptionText.Text
  673.     dwCmdDialog.RaiseCallbackEvent = RaiseEventCheck.Value
  674.     dwCmdDialog.CancelError = CancelErrorCheck.Value
  675.     dwCmdDialog.Flags = GetPageSetupFlags()
  676.     If DisablePagePaintCheck.Value Then
  677.         dwCmdDialog.Flags = dwCmdDialog.Flags Or glmcdPSDDisablePagePainting
  678.     End If
  679.     dwCmdDialog.HelpFile = Trim$(HelpFileText.Text)
  680.     If dwCmdDialog.HelpFile <> "" Then
  681.         If HelpContextOpt.Value Then
  682.             dwCmdDialog.HelpCommand = glmcdHCContext
  683.             dwCmdDialog.HelpContext = Val(HelpContextNumberText.Text)
  684.         Else
  685.             dwCmdDialog.HelpCommand = glmcdHCKey
  686.             dwCmdDialog.HelpKey = HelpKeyText.Text
  687.         End If
  688.     End If
  689.     multiplier = 1
  690.     If List1.Selected(3) Then multiplier = 100
  691.     If List1.Selected(2) Then multiplier = 1000
  692.     ' If the margins flag is specified, validate margins
  693.     If List1.Selected(1) Then
  694.         If TopMarginText.Text <> "" Then
  695.             dwCmdDialog.TopMargin = CDbl(TopMarginText.Text) * multiplier
  696.         End If
  697.         If BottomMarginText.Text <> "" Then
  698.             dwCmdDialog.BottomMargin = CDbl(BottomMarginText.Text) * multiplier
  699.         End If
  700.         If LeftMarginText.Text <> "" Then
  701.             dwCmdDialog.LeftMargin = CDbl(LeftMarginText.Text) * multiplier
  702.         End If
  703.         If RightMarginText.Text <> "" Then
  704.             dwCmdDialog.RightMargin = CDbl(RightMarginText.Text) * multiplier
  705.         End If
  706.     End If
  707.     ' If the min margin flag is specified, validate min margins
  708.     If List1.Selected(0) Then
  709.         If TopMinMarginText.Text <> "" Then
  710.             dwCmdDialog.TopMinMargin = CDbl(TopMinMarginText.Text) * multiplier
  711.         End If
  712.         If BottomMinMarginText.Text <> "" Then
  713.             dwCmdDialog.BottomMinMargin = CDbl(BottomMinMarginText.Text) * multiplier
  714.         End If
  715.         If LeftMinMarginText.Text <> "" Then
  716.             dwCmdDialog.LeftMinMargin = CDbl(LeftMinMarginText.Text) * multiplier
  717.         End If
  718.         If RightMinMarginText.Text <> "" Then
  719.             dwCmdDialog.RightMinMargin = CDbl(RightMinMarginText.Text) * multiplier
  720.         End If
  721.     End If
  722.     ' Assign paper orientation
  723.     If PortraitOpt.Value Then
  724.         dwCmdDialog.PageOrientation = glmcdPSDOrientPortrait
  725.     Else
  726.         dwCmdDialog.PageOrientation = glmcdPSDOrientLandscape
  727.     End If
  728.     ' Assign paper size
  729.     If PaperSizeCombo.ListIndex <> -1 Then
  730.         dwCmdDialog.PaperSize = PaperSizeCombo.ListIndex + 1
  731.     End If
  732.     ' Assign paper source
  733.     If PaperSourceCombo.ListIndex <> -1 Then
  734.         dwCmdDialog.PaperSource = PaperSourceCombo.ListIndex + 1
  735.     End If
  736.     lres = dwCmdDialog.ShowPageSetup
  737.     If lres = 1 Then
  738.         TopMarginText.Text = dwCmdDialog.TopMargin / multiplier
  739.         TopMinMarginText.Text = dwCmdDialog.TopMinMargin / multiplier
  740.         BottomMarginText.Text = dwCmdDialog.BottomMargin / multiplier
  741.         BottomMinMarginText.Text = dwCmdDialog.BottomMinMargin / multiplier
  742.         LeftMarginText.Text = dwCmdDialog.LeftMargin / multiplier
  743.         LeftMinMarginText.Text = dwCmdDialog.LeftMinMargin / multiplier
  744.         RightMarginText.Text = dwCmdDialog.RightMargin / multiplier
  745.         RightMinMarginText.Text = dwCmdDialog.RightMinMargin / multiplier
  746.         If dwCmdDialog.PageOrientation = glmcdPSDOrientPortrait Then
  747.             PortraitOpt.Value = True
  748.         Else
  749.             LandscapeOpt.Value = True
  750.         End If
  751.         
  752.         If (dwCmdDialog.PaperSize <> 0) And (dwCmdDialog.PaperSize < PaperSizeCombo.ListCount) Then
  753.             PaperSizeCombo.ListIndex = dwCmdDialog.PaperSize - 1
  754.         End If
  755.         If (dwCmdDialog.PaperSource <> 0) And (dwCmdDialog.PaperSource < PaperSourceCombo.ListCount) Then
  756.             PaperSourceCombo.ListIndex = dwCmdDialog.PaperSource - 1
  757.         End If
  758.     End If
  759.     Set dwCmdDialog = Nothing
  760. End Sub
  761. ' Fills the specified list or combo box with the paper
  762. ' sizes defined by Windows. Note that not all printers
  763. ' supports every size, this is a complete list of all
  764. ' paper sizes that Windows recognizes.
  765. Public Sub FillPaperSizeList(lbox As Control)
  766.     lbox.AddItem "Letter 8 1/2 x 11 in"
  767.     lbox.AddItem "Letter Small 8 1/2 x 11 in"
  768.     lbox.AddItem "Tabloid 11 x 17 in"
  769.     lbox.AddItem "Ledger 17 x 11 in"
  770.     lbox.AddItem "Legal 8 1/2 x 14 in"
  771.     lbox.AddItem "Statement 5 1/2 x 8 1/2 in"
  772.     lbox.AddItem "Executive 7 1/4 x 10 1/2 in"
  773.     lbox.AddItem "A3 297 x 420 mm"
  774.     lbox.AddItem "A4 210 x 297 mm"
  775.     lbox.AddItem "A4 Small 210 x 297 mm"
  776.     lbox.AddItem "A5 148 x 210 mm"
  777.     lbox.AddItem "B4 (JIS) 250 x 354"
  778.     lbox.AddItem "B5 (JIS) 182 x 257 mm"
  779.     lbox.AddItem "Folio 8 1/2 x 13 in"
  780.     lbox.AddItem "Quarto 215 x 275 mm"
  781.     lbox.AddItem "10x14 in"
  782.     lbox.AddItem "11x17 in"
  783.     lbox.AddItem "Note 8 1/2 x 11 in"
  784.     lbox.AddItem "Envelope #9 3 7/8 x 8 7/8"
  785.     lbox.AddItem "Envelope #10 4 1/8 x 9 1/2"
  786.     lbox.AddItem "Envelope #11 4 1/2 x 10 3/8"
  787.     lbox.AddItem "Envelope #12 4 \276 x 11"
  788.     lbox.AddItem "Envelope #14 5 x 11 1/2"
  789.     lbox.AddItem "C size sheet"
  790.     lbox.AddItem "D size sheet"
  791.     lbox.AddItem "E size sheet"
  792.     lbox.AddItem "Envelope DL 110 x 220mm"
  793.     lbox.AddItem "Envelope C5 162 x 229 mm"
  794.     lbox.AddItem "Envelope C3  324 x 458 mm"
  795.     lbox.AddItem "Envelope C4  229 x 324 mm"
  796.     lbox.AddItem "Envelope C6  114 x 162 mm"
  797.     lbox.AddItem "Envelope C65 114 x 229 mm"
  798.     lbox.AddItem "Envelope B4  250 x 353 mm"
  799.     lbox.AddItem "Envelope B5  176 x 250 mm"
  800.     lbox.AddItem "Envelope B6  176 x 125 mm"
  801.     lbox.AddItem "Envelope 110 x 230 mm"
  802.     lbox.AddItem "Envelope Monarch 3.875 x 7.5 in"
  803.     lbox.AddItem "6 3/4 Envelope 3 5/8 x 6 1/2 in"
  804.     lbox.AddItem "US Std Fanfold 14 7/8 x 11 in"
  805.     lbox.AddItem "German Std Fanfold 8 1/2 x 12 in"
  806.     lbox.AddItem "German Legal Fanfold 8 1/2 x 13 in"
  807.     lbox.AddItem "B4 (ISO) 250 x 353 mm"
  808.     lbox.AddItem "Japanese Postcard 100 x 148 mm"
  809.     lbox.AddItem "9 x 11 in"
  810.     lbox.AddItem "10 x 11 in"
  811.     lbox.AddItem "15 x 11 in"
  812.     lbox.AddItem "Envelope Invite 220 x 220 mm"
  813.     lbox.AddItem "RESERVED--DO NOT USE"
  814.     lbox.AddItem "RESERVED--DO NOT USE"
  815.     lbox.AddItem "Letter Extra 9 \275 x 12 in"
  816.     lbox.AddItem "Legal Extra 9 \275 x 15 in"
  817.     lbox.AddItem "Tabloid Extra 11.69 x 18 in"
  818.     lbox.AddItem "A4 Extra 9.27 x 12.69 in"
  819.     lbox.AddItem "Letter Transverse 8 \275 x 11 in"
  820.     lbox.AddItem "A4 Transverse 210 x 297 mm"
  821.     lbox.AddItem "Letter Extra Transverse 9\275 x 12 in"
  822.     lbox.AddItem "SuperA/SuperA/A4 227 x 356 mm"
  823.     lbox.AddItem "SuperB/SuperB/A3 305 x 487 mm"
  824.     lbox.AddItem "Letter Plus 8.5 x 12.69 in"
  825.     lbox.AddItem "A4 Plus 210 x 330 mm"
  826.     lbox.AddItem "A5 Transverse 148 x 210 mm"
  827.     lbox.AddItem "B5 (JIS) Transverse 182 x 257 mm"
  828.     lbox.AddItem "A3 Extra 322 x 445 mm"
  829.     lbox.AddItem "A5 Extra 174 x 235 mm"
  830.     lbox.AddItem "B5 (ISO) Extra 201 x 276 mm"
  831.     lbox.AddItem "A2 420 x 594 mm"
  832.     lbox.AddItem "A3 Transverse 297 x 420 mm"
  833.     lbox.AddItem "A3 Extra Transverse 322 x 445 mm"
  834. End Sub
  835. ' Fills the specified list or combo box with the paper
  836. ' sources defined by Windows. Note that not all printers
  837. ' supports every source, this is a complete list of all
  838. ' paper sources that Windows recognizes.
  839. Public Sub FillPaperSourceList(lbox As Control)
  840.      lbox.AddItem "Upper"
  841.      lbox.AddItem "Lower"
  842.      lbox.AddItem "Middle"
  843.      lbox.AddItem "Manual"
  844.      lbox.AddItem "Envelope"
  845.      lbox.AddItem "Envelope Manual"
  846.      lbox.AddItem "Auto"
  847.      lbox.AddItem "Tractor"
  848.      lbox.AddItem "Small Format"
  849.      lbox.AddItem "Large Format"
  850.      lbox.AddItem "Large Capacity"
  851.      lbox.AddItem "RESERVED--DO NOT USE"
  852.      lbox.AddItem "RESERVED--DO NOT USE"
  853.      lbox.AddItem "Cassette"
  854.      lbox.AddItem "Form Source"
  855.      lbox.AddItem "Device Specific"
  856. End Sub
  857.