コード例 #1
0
        public void PageToScreen(BindingAssembly.Page page)
        {
            chkSetPage.Checked = page.Perform;
            txtHeight.Text     = $"{page.Height:0.####}";
            txtWidth.Text      = $"{page.Width:0.####}";
            switch (page.Orientation)
            {
            case BindingAssembly.PageOrientation.DontSet:
                rdoPortrait.Checked  = false;
                rdoLandscape.Checked = false;
                break;

            case BindingAssembly.PageOrientation.Landscape:
                rdoPortrait.Checked  = false;
                rdoLandscape.Checked = true;
                break;

            case BindingAssembly.PageOrientation.Portrait:
                rdoPortrait.Checked  = true;
                rdoLandscape.Checked = false;
                break;

            default:
                throw new InvalidDataException("Unrecognized orientation");
            }

            setPageControlsEnabled();
        }
コード例 #2
0
        public void ScreenToPage(BindingAssembly.Page page)
        {
            page.Perform = chkSetPage.Checked;
            double height = 0.0, width = 0.0;

            if (double.TryParse(txtHeight.Text, out height))
            {
                page.Height = height;
            }
            if (double.TryParse(txtWidth.Text, out width))
            {
                page.Width = width;
            }
            if (rdoLandscape.Checked)
            {
                page.Orientation = BindingAssembly.PageOrientation.Landscape;
            }
            else if (rdoPortrait.Checked)
            {
                page.Orientation = BindingAssembly.PageOrientation.Portrait;
            }
            else
            {
                page.Orientation = BindingAssembly.PageOrientation.DontSet;
            }
        }