Integration of RadForm in RadPageView

4 posts, 1 answers
  1. Fabien Masson
    Fabien Masson avatar
    11 posts
    Member since:
    Jul 2009

    Posted 18 Oct 2010 Link to this post

    Dear support team,
     
      I have written an application with 10 forms and need to manually copy code and ressources from RadForm (debug version) to RadPageViewPage (release) and tweak few lines each time...
      As you will probably agree, it's quite painful and hard to maintain.
     
      Do you support the integration of normal RadForm in a RadPageView container ?
      Or Do you have other tip for maintaining this, knowing that it is impossible to edit a derivated RadPageViewPage in Visual Studio 2008 ?
     
      Best regards,
    Fabien.
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 18 Oct 2010 Link to this post

    Hello Fabien,

    I would suggest using a Dock for this, the Dock offers built in support for MDI.

    For even more information about using about docking forms and user controls please check out this help article.

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Fabien Masson
    Fabien Masson avatar
    11 posts
    Member since:
    Jul 2009

    Posted 18 Oct 2010 Link to this post

    Dear Emanuel,

      It would probably involve more code redesign to block docking behavior and icons support.
      In this case, it is probably better to use Ribbon, isn't it ?

      Regards,
    Fabien.
  5. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 18 Oct 2010 Link to this post

    Hello again Fabien,

    Me, for one i prefer the Dock for such things, but here you have an example on how to add normal forms to pages as controls, i hope this helps:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Telerik.WinControls.UI;
     
    namespace IntergratingFormsInPageView
    {
        public partial class Form1 : Form
        {
            private RadPageView radPageView1;
            public Form1()
            {
                InitializeComponent();
                this.Controls.Add(radPageView1 = new RadPageView());
                radPageView1.Size = new Size(this.ClientSize.Width, this.ClientSize.Height - 24);
                radPageView1.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
     
                var addFormButton = new RadButton();
                addFormButton.Text = "Add Form";
                addFormButton.Click += new EventHandler(addFormButton_Click);
                addFormButton.Dock = DockStyle.Bottom;
                this.Controls.Add(addFormButton);
            }
     
            void addFormButton_Click(object sender, EventArgs e)
            {
                var childForm = new ChildForm();
                childForm.TopLevel = false;
                childForm.Dock = DockStyle.Fill;
                childForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                 
                var page = new RadPageViewPage();
                childForm.Parent = page;
                page.Text = "Page " + (radPageView1.Pages.Count + 1).ToString();
                page.Controls.Add(childForm);
     
                radPageView1.Pages.Add(page);
                childForm.Show();
            }
        }
     
        public class ChildForm : Form
        {
            public ChildForm()
            {
                InitializeComponent();
                this.Controls.Add(new RadTextBox());
                var grid = new RadGridView();
                grid.Dock = DockStyle.Bottom;
                this.Controls.Add(grid);
            }
     
            private System.ComponentModel.IContainer components;
     
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
     
            #region Windows Form Designer generated code
     
            private void InitializeComponent()
            {
                this.components = new System.ComponentModel.Container();
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.Text = "Form1";
            }
     
            #endregion
        }
    }

    It seems pretty straight forward to me...

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
Back to Top