Esempio n. 1
0
        internal void ApplyAeroStyle()
        {
            if (!DWMAPI.IsCompositionEnabled || this.IsDesignMode || this.parentForm == null)
            {
                return;
            }
            RadForm parentForm = this.parentForm as RadForm;

            if (parentForm != null)
            {
                parentForm.AllowTheming          = false;
                parentForm.RootElement.BackColor = Color.Transparent;
            }
            else
            {
                this.parentForm.BackColor = Color.Black;
            }
            this.RootElement.BackColor = Color.Transparent;
            DWMAPI.DwmExtendFrameIntoClientArea(this.parentForm.Handle, ref new Telerik.WinControls.NativeMethods.MARGINS()
            {
                cxLeftWidth    = 0,
                cxRightWidth   = 0,
                cyTopHeight    = this.Dock != DockStyle.Fill || this.Pages.Count == 0 ? this.parentForm.Size.Height : this.PageHeaderElement.Size.Height,
                cyBottomHeight = 0
            });
            this.parentForm.Refresh();
        }
Esempio n. 2
0
 public MainForm()
 {
     InitializeComponent();
     RadMessageBox.SetThemeName(OfficeTheme.ThemeName);
     txtFileLocation = this.FileLocationPath;
     Instance        = this;
 }
Esempio n. 3
0
        internal void UnapplyAeroStyle()
        {
            if (!DWMAPI.IsCompositionEnabled || this.IsDesignMode || this.parentForm == null)
            {
                return;
            }

            RadForm radForm = this.parentForm as RadForm;

            if (radForm != null)
            {
                radForm.AllowTheming = true;
                radForm.RootElement.ResetValue(VisualElement.BackColorProperty, ValueResetFlags.Local);
            }

            IntPtr hwnd = this.parentForm.Handle;

            NativeMethods.MARGINS margins = new NativeMethods.MARGINS();
            margins.cxLeftWidth    = 0;
            margins.cxRightWidth   = 0;
            margins.cyTopHeight    = 0;
            margins.cyBottomHeight = 0;
            DWMAPI.DwmExtendFrameIntoClientArea(hwnd, ref margins);

            this.parentForm.Refresh();
        }
Esempio n. 4
0
        /// <summary>
        /// OnMouseMove
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            Form form = this.ElementTree.Control.FindForm();

            if (form == null)
            {
                return;
            }

            int wParam = 0;

            FormBorderStyle borderStyle = FormBorderStyle.None;
            RadForm         radForm     = form as RadForm;

            //fixed #300984 - gripUnable to resize RadForm
            if (radForm != null)
            {
                borderStyle = radForm.FormBorderStyle;
            }
            else
            {
                borderStyle = form.FormBorderStyle;
            }

            if (this.Parent != null &&
                form.WindowState != FormWindowState.Maximized &&
                (borderStyle != FormBorderStyle.None || (form is ShapedForm && (form as ShapedForm).AllowResize) || form is RadRibbonForm) &&
                borderStyle != FormBorderStyle.Fixed3D &&
                borderStyle != FormBorderStyle.FixedDialog &&
                borderStyle != FormBorderStyle.FixedSingle &&
                borderStyle != FormBorderStyle.FixedToolWindow)
            {
                if (this.RightToLeft)
                {
                    if (e.X < mouseResizeOffset && e.Y > this.Parent.Size.Height - mouseResizeOffset)
                    {
                        Cursor.Current = Cursors.SizeNESW;
                        wParam         = NativeMethods.HTBOTTOMLEFT;
                    }
                }
                else
                {
                    if (e.X > this.Parent.Size.Width - mouseResizeOffset && e.Y > this.Parent.Size.Height - mouseResizeOffset)
                    {
                        Cursor.Current = Cursors.SizeNWSE;
                        wParam         = NativeMethods.HTBOTTOMRIGHT;
                    }
                }

                if (e.Button == MouseButtons.Left && downPoint != e.Location)
                {
                    NativeMethods.ReleaseCapture();
                    NativeMethods.SendMessage(new HandleRef(this, form.Handle), NativeMethods.WM_NCLBUTTONDOWN, wParam, IntPtr.Zero);
                }
            }
        }
Esempio n. 5
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            Form form = this.ElementTree.Control.FindForm();

            if (form == null)
            {
                return;
            }
            int             wParam          = 0;
            RadForm         radForm         = form as RadForm;
            FormBorderStyle formBorderStyle = radForm == null ? form.FormBorderStyle : radForm.FormBorderStyle;

            if (form is RadRibbonForm)
            {
                formBorderStyle = ((RadRibbonForm)form).FormBorderStyle;
            }
            if (this.Parent == null || form.WindowState == FormWindowState.Maximized || formBorderStyle == FormBorderStyle.None && (!(form is ShapedForm) || !(form as ShapedForm).AllowResize) && !(form is RadRibbonForm) || (formBorderStyle == FormBorderStyle.Fixed3D || formBorderStyle == FormBorderStyle.FixedDialog || (formBorderStyle == FormBorderStyle.FixedSingle || formBorderStyle == FormBorderStyle.FixedToolWindow)))
            {
                return;
            }
            if (this.RightToLeft)
            {
                if (e.X < 15 && e.Y > this.Parent.Size.Height - 15)
                {
                    Cursor.Current = Cursors.SizeNESW;
                    wParam         = 16;
                }
            }
            else if (e.X > this.Parent.Size.Width - 15 && e.Y > this.Parent.Size.Height - 15)
            {
                Cursor.Current = Cursors.SizeNWSE;
                wParam         = 17;
            }
            if (e.Button != MouseButtons.Left || !(this.downPoint != e.Location))
            {
                return;
            }
            Telerik.WinControls.NativeMethods.ReleaseCapture();
            Telerik.WinControls.NativeMethods.SendMessage(new HandleRef((object)this, form.Handle), 161, wParam, IntPtr.Zero);
        }
        protected virtual void OnShowPrintSettingsDialog()
        {
            if (this.Document == null)
            {
                return;
            }
            Form    settingsDialog = this.Document.AssociatedObject.GetSettingsDialog(this.Document);
            RadForm radForm        = settingsDialog as RadForm;

            if (radForm != null)
            {
                radForm.ThemeName = this.ThemeName;
            }
            if (settingsDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            this.Document.PrinterSettings.PrintRange = PrintRange.AllPages;
            this.printPreviewControl.InvalidatePreview();
            this.UpdatePageCount();
        }
Esempio n. 7
0
        internal void UnapplyAeroStyle()
        {
            if (!DWMAPI.IsCompositionEnabled || this.IsDesignMode || this.parentForm == null)
            {
                return;
            }
            RadForm parentForm = this.parentForm as RadForm;

            if (parentForm != null)
            {
                parentForm.AllowTheming = true;
                int num = (int)parentForm.RootElement.ResetValue(VisualElement.BackColorProperty, ValueResetFlags.Local);
            }
            DWMAPI.DwmExtendFrameIntoClientArea(this.parentForm.Handle, ref new Telerik.WinControls.NativeMethods.MARGINS()
            {
                cxLeftWidth    = 0,
                cxRightWidth   = 0,
                cyTopHeight    = 0,
                cyBottomHeight = 0
            });
            this.parentForm.Refresh();
        }
        public override ControlStyleBuilderInfoList GetThemeDesignedControls(System.Windows.Forms.Control previewSurface)
        {
            RadForm radFormPreview = new RadForm();

            radFormPreview.Behavior.DisableMouseEvents = true;
            radFormPreview.Size       = new Size(320, 240);
            radFormPreview.AutoScroll = true;

            System.Windows.Forms.Button btn = new System.Windows.Forms.Button();
            btn.Location = new Point(3000, 3000);

            radFormPreview.Controls.Add(btn);
            radFormPreview.Text = "RadForm";

            radFormPreview.Anchor =
                System.Windows.Forms.AnchorStyles.Bottom
                | System.Windows.Forms.AnchorStyles.Left
                | System.Windows.Forms.AnchorStyles.Right
                | System.Windows.Forms.AnchorStyles.Top;

            RadForm radFormStructure = new RadForm();

            radFormStructure.AutoSize = true;

            radFormStructure.Text = "RadForm";
            radFormStructure.Size = new Size(320, 240);

            ControlStyleBuilderInfoList res = new ControlStyleBuilderInfoList();

            ControlStyleBuilderInfo designed = new ControlStyleBuilderInfo(radFormPreview, radFormStructure.RootElement);

            designed.MainElementClassName = radFormStructure.FormElement.GetThemeEffectiveType().FullName;
            designed.ExcludeStructureElementsAndHierarchy.Add(radFormStructure.FormElement.TitleBar);
            designed.ExcludeStructureElementsAndHierarchy.Add(radFormStructure.FormElement.HorizontalScrollbar);
            designed.ExcludeStructureElementsAndHierarchy.Add(radFormStructure.FormElement.VerticalScrollbar);
            res.Add(designed);

            return(res);
        }
Esempio n. 9
0
        internal void ApplyAeroStyle()
        {
            if (!DWMAPI.IsCompositionEnabled || this.IsDesignMode || this.parentForm == null)
            {
                return;
            }

            RadForm radForm = this.parentForm as RadForm;

            if (radForm != null)
            {
                radForm.AllowTheming          = false;
                radForm.RootElement.BackColor = Color.Transparent;
            }
            else
            {
                this.parentForm.BackColor = Color.Black;
            }
            this.RootElement.BackColor = Color.Transparent;

            IntPtr hwnd = this.parentForm.Handle;

            NativeMethods.MARGINS margins = new NativeMethods.MARGINS();
            margins.cxLeftWidth  = 0;
            margins.cxRightWidth = 0;
            if (this.Dock != DockStyle.Fill || this.Pages.Count == 0)
            {
                margins.cyTopHeight = this.parentForm.Size.Height;
            }
            else
            {
                margins.cyTopHeight = this.PageHeaderElement.Size.Height;
            }
            margins.cyBottomHeight = 0;
            DWMAPI.DwmExtendFrameIntoClientArea(hwnd, ref margins);

            this.parentForm.Refresh();
        }
Esempio n. 10
0
        protected virtual void OnDialogButtonClick(EventArgs e)
        {
            this.colorDialog.SelectedColor = this.value;
            RadForm    colorDialogForm = this.colorDialog.ColorDialogForm as RadForm;
            RadControl control         = this.ElementTree.Control as RadControl;

            if (colorDialogForm != null && control != null)
            {
                colorDialogForm.ThemeName   = control.ThemeName;
                colorDialogForm.RightToLeft = control.RightToLeft;
            }
            colorDialogForm.EnableAnalytics = this.EnableAnalytics;
            DialogResult dialogResult = this.colorDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                string text = this.converter.ConvertToString((ITypeDescriptorContext)null, Thread.CurrentThread.CurrentCulture, (object)this.colorDialog.SelectedColor);
                bool   flag = this.ReadOnly;
                this.ReadOnly = false;
                this.Value    = (Color)this.converter.ConvertFromString((ITypeDescriptorContext)null, Thread.CurrentThread.CurrentCulture, text);
                this.ReadOnly = flag;
            }
            this.OnDialogClosed(new DialogClosedEventArgs(dialogResult));
        }