コード例 #1
0
        private void _sizeModeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            _sizeMode = Tools.ValueNameItem <CodecsRasterizeDocumentSizeMode> .GetSelectedItem(_sizeModeComboBox.SelectedItem);

            // Update the help
            _sizeModeHelp.Text = _sizeModeDescription[(int)_sizeMode];

            UpdateUIState();
        }
コード例 #2
0
        /// <summary>
        /// Called by the owner to initialize
        /// </summary>
        public void SetData(RasterCodecs rasterCodecsInstance)
        {
            // Set the state of the controls

            // Event hooks
            _pageWidthTextBox.PreviewKeyDown += new PreviewKeyDownEventHandler(_textBox_PreviewKeyDown);
            _pageWidthTextBox.LostFocus      += new EventHandler(_textBox_LostFocus);

            _pageHeightTextBox.PreviewKeyDown += new PreviewKeyDownEventHandler(_textBox_PreviewKeyDown);
            _pageHeightTextBox.LostFocus      += new EventHandler(_textBox_LostFocus);

            _leftMarginTextBox.PreviewKeyDown += new PreviewKeyDownEventHandler(_textBox_PreviewKeyDown);
            _leftMarginTextBox.LostFocus      += new EventHandler(_textBox_LostFocus);

            _topMarginTextBox.PreviewKeyDown += new PreviewKeyDownEventHandler(_textBox_PreviewKeyDown);
            _topMarginTextBox.LostFocus      += new EventHandler(_textBox_LostFocus);

            _rightMarginTextBox.PreviewKeyDown += new PreviewKeyDownEventHandler(_textBox_PreviewKeyDown);
            _rightMarginTextBox.LostFocus      += new EventHandler(_textBox_LostFocus);

            _bottomMarginTextBox.PreviewKeyDown += new PreviewKeyDownEventHandler(_textBox_PreviewKeyDown);
            _bottomMarginTextBox.LostFocus      += new EventHandler(_textBox_LostFocus);

            _resolutionComboBox.PreviewKeyDown += new PreviewKeyDownEventHandler(_textBox_PreviewKeyDown);
            _resolutionComboBox.LostFocus      += new EventHandler(_resolutionComboBox_LostFocus);

            // Initialize the units
            _unitComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentUnit>(CodecsRasterizeDocumentUnit.Pixel, "Pixel"));
            _unitComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentUnit>(CodecsRasterizeDocumentUnit.Inch, "Inch"));
            _unitComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentUnit>(CodecsRasterizeDocumentUnit.Millimeter, "Millimeter"));

            _sizeModeComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentSizeMode>(CodecsRasterizeDocumentSizeMode.None, "None"));
            _sizeModeComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentSizeMode>(CodecsRasterizeDocumentSizeMode.Fit, "Fit"));
            _sizeModeComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentSizeMode>(CodecsRasterizeDocumentSizeMode.FitAlways, "Fit always"));
            _sizeModeComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentSizeMode>(CodecsRasterizeDocumentSizeMode.FitWidth, "Fit width"));
            _sizeModeComboBox.Items.Add(new Tools.ValueNameItem <CodecsRasterizeDocumentSizeMode>(CodecsRasterizeDocumentSizeMode.Stretch, "Stretch"));

            CodecsRasterizeDocumentLoadOptions rasterizeDocumentLoadOptions = rasterCodecsInstance.Options.RasterizeDocument.Load;

            // Get the temporary values
            _pageWidth    = rasterizeDocumentLoadOptions.PageWidth;
            _pageHeight   = rasterizeDocumentLoadOptions.PageHeight;
            _leftMargin   = rasterizeDocumentLoadOptions.LeftMargin;
            _topMargin    = rasterizeDocumentLoadOptions.TopMargin;
            _rightMargin  = rasterizeDocumentLoadOptions.RightMargin;
            _bottomMargin = rasterizeDocumentLoadOptions.BottomMargin;
            _unit         = rasterizeDocumentLoadOptions.Unit;
            _resolution   = rasterizeDocumentLoadOptions.XResolution;
            _sizeMode     = rasterizeDocumentLoadOptions.SizeMode;

            // Now set the current values

            UpdateControlsFromValues();

            UpdateUIState();
        }
コード例 #3
0
        private void UpdateUIState()
        {
            CodecsRasterizeDocumentSizeMode sizeMode = Tools.ValueNameItem <CodecsRasterizeDocumentSizeMode> .GetSelectedItem(_sizeModeComboBox.SelectedItem);

            _pageWidthTextBox.Enabled    = (sizeMode != CodecsRasterizeDocumentSizeMode.None);
            _pageHeightTextBox.Enabled   = (sizeMode != CodecsRasterizeDocumentSizeMode.None) && (sizeMode != CodecsRasterizeDocumentSizeMode.FitWidth);
            _leftMarginTextBox.Enabled   = (sizeMode != CodecsRasterizeDocumentSizeMode.None);
            _topMarginTextBox.Enabled    = (sizeMode != CodecsRasterizeDocumentSizeMode.None);
            _rightMarginTextBox.Enabled  = (sizeMode != CodecsRasterizeDocumentSizeMode.None);
            _bottomMarginTextBox.Enabled = (sizeMode != CodecsRasterizeDocumentSizeMode.None);
            _unitComboBox.Enabled        = (sizeMode != CodecsRasterizeDocumentSizeMode.None);
        }
コード例 #4
0
        private void _resetToDefaultsButton_Click(object sender, EventArgs e)
        {
            _pageWidth    = 8.5;
            _pageHeight   = 11;
            _leftMargin   = 1.25;
            _topMargin    = 1;
            _rightMargin  = 1.25;
            _bottomMargin = 1;
            _unit         = CodecsRasterizeDocumentUnit.Inch;
            _resolution   = 0;
            _sizeMode     = CodecsRasterizeDocumentSizeMode.None;

            UpdateControlsFromValues();
            UpdateUIState();
        }