コード例 #1
0
        // ####### INITIALIZATION METHODS #######

        /// <summary>
        /// Creates Page Formats and adds them to the appropriate form control
        /// </summary>
        private void populatePageSizes()
        {
            A4_port     = new PageFormat("A4 Portrait", 21.0, 29.7, cm, true);
            letter_port = new PageFormat("Letter Portrait", 8.5, 11, inch, true);
            A4_land     = new PageFormat("A4 Landscape", 29.7, 21.0, cm, false);
            letter_land = new PageFormat("Letter Landscape", 11, 8.5, inch, false);


            pagesList.Add(A4_port);
            pagesList.Add(letter_port);
            pagesList.Add(A4_land);
            pagesList.Add(letter_land);

            foreach (PageFormat p in pagesList)
            {
                comboBoxPageFormat.Items.Add(p);
            }
        }
コード例 #2
0
        /// <summary>
        /// Sets the input variables to their default values
        /// and updates the form fields with the corresponding values
        /// </summary>
        private void SetInputDefaults()
        {
            // set variables
            selectedUnit   = cm;
            selectedFormat = A4_port;
            sizeWidth      = DEFAULT_SIZE;
            sizeHeight     = DEFAULT_SIZE;
            marginTop      = DEFAULT_MARGIN;
            overlapTop     = DEFAULT_OVERLAP;

            // set form fields
            comboBoxUoM.SelectedItem        = cm;
            comboBoxPageFormat.SelectedItem = A4_port;

            textBoxSizeWidth.Text  = sizeWidth.ToString("F2");
            textBoxSizeHeight.Text = sizeHeight.ToString("F2");
            textBoxMarginTop.Text  = marginTop.ToString("F2");
            textBoxOverlapTop.Text = overlapTop.ToString("F2");

            checkBoxMaintainSizeRatio.Checked = true;
            checkBoxMarginAllSides.Checked    = true;
            checkBoxOverlapAllSides.Checked   = true;
        }
コード例 #3
0
 /// <summary>
 /// On index change, updates the selected page format variable
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxPageFormat_SelectedIndexChanged(object sender, EventArgs e)
 {
     selectedFormat = (PageFormat)comboBoxPageFormat.SelectedItem;
 }