Alignment of Editors

3 posts, 0 answers
  1. Craig Booth
    Craig Booth avatar
    7 posts
    Member since:
    Jun 2005

    Posted 07 Jan 2010 Link to this post

    While experimenting with a workaround, I was trying to closely align 3 editors so I could create a PropertyGrid style panel. Using the code below, the controls overlap each, but if I use the MS controls they align perfectly - am I missing something.

            Dim d As New RadTextBox
            d.Size = New System.Drawing.Size(95, 14)
            d.Location = New System.Drawing.Point(300, 200)
            d.Text = "Text One"
            TabItem4.ContentPanel.Controls.Add(d)

            Dim e As New RadDateTimePicker
            e.Size = d.Size
            e.Left = d.Left
            e.Top = d.Bounds.Bottom
            TabItem4.ContentPanel.Controls.Add(e)

            Dim f As New RadMaskedEditBox
            f.Size = d.Size
            f.Left = d.Left
            f.Top = e.Bounds.Bottom
            f.Text = "Text Two"
            TabItem4.ContentPanel.Controls.Add(f)

    Any suggestions?

    Thanks.
  2. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 07 Jan 2010 Link to this post

    Hello Craig Booth,

    Please note that the custom size that you set is not applied, no matter whether you are using Microsoft controls or RadControls. This is because the size of the editors is defined by the size of their font.

    However, there is a difference between Microsoft controls and RadControls. Please note that when you set the Size.Height of a TextBox to 14, its Bounds.Bottom is still the default 20.

    If you set the Size.Height of a RadTextBox to 14, you will get 14 for its Bounds.Bottom, but not 20. They will get their height of 20 at a later moment. This is done for optimization purposes. In order to get the real Bounds in your case, you should call the LoadElementTree() method:
    Dim d As New RadTextBox
    d.Size = New System.Drawing.Size(95, 14)
    d.Location = New System.Drawing.Point(300, 200)
    d.Text = "Text One"
    TabItem4.ContentPanel.Controls.Add(d)
    d.LoadElementTree()

    Dim e As New RadDateTimePicker
    e.Size = d.Size
    e.Left = d.Left
    e.Top = d.Bounds.Bottom '20
    TabItem4.ContentPanel.Controls.Add(e)
    e.LoadElementTree()

    Dim f As New RadMaskedEditBox
    f.Size = d.Size
    f.Left = d.Left
    f.Top = e.Bounds.Bottom '20
    f.Text = "Text Two"
    TabItem4.ContentPanel.Controls.Add(f)

    I hope this helps. If you have additional questions, feel free to contact me.

    Sincerely yours,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 19 Jul 2011 Link to this post

    Hi Craig,

    Have you heard the good news? A week ago we released RadControls for WinForms Q2 2011 and there we introduced the RadPropertyGrid for WinForms. Feel free to register for the Free Webinar for Desktop Developers that will take place on July 20.

    Best wishes,
    Nikolay
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top