This is a migrated thread and some comments may be shown as answers.

RadLayoutControl re-drawing?

3 Answers 174 Views
LayoutControl
This is a migrated thread and some comments may be shown as answers.
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Curtis asked on 05 Jun 2018, 11:00 PM

I have a very simple RadLayoutControl with two LayoutControlItems inside it - each Control Item has a RadListControl - these are stacked on top of each other.

Each LayoutControlItem is the same height - a 50/50 split which is exactly what I want.

Unfortunately because of how WinForms are displayed - the form is first drawn as the same size as it is in the designer...then everything expands to the actual size of the form and you get this ugly double-painting effect...my RadLayoutControl is shown...then blink and it's redrawn at its Run-Time size and everything resizes correctly.

Well, I hate that WinForms do that...and I'm not smart enough to know how to tell the application, "Hey! Don't draw anything until the form has finished resizing!" so I fake it...anything that gives me this double-paint I set Visible = false and once the form's finished its resizing I set Visible = True.

My problem is this:  With the RadLayoutControl doing this:  The TOP panel is the same size as in the designer and only the bottom panel resizes to fill the rest of the space.

 

My question is this:  Is there any way I can tell the RadLayoutControl, "Take your current height and go resize everything equally" so I wind up with two panels the same height?

 

I've attached a couple of images to show you what I mean.  One shows you how I want it to look and the other shows how it does look.  Hopefully you can make sense of this post and I don't sound like some crazy guy trying to do something I shouldn't be...heck if anyone there knows anyway to tell a WinForm not to paint until it's resized that would solve everything :)

 

-C

 

 

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 06 Jun 2018, 10:21 AM
Hi Curtis,

I am not sure what is going on with the form. On my side, this cannot be reproduced by hiding the control resizing the form and then showing it again.

However, your layout is simple and there is an easy way to resize the items. Here is the code:
var totalHeight = radListControl1.Height +radListControl2.Height;
 
radLayoutControl1.ResizeItem(radListControl1, (totalHeight / 2) - radListControl.Height);

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 25 Jun 2018, 07:46 PM

That works perfectly, Dimitar.

As for the "resizing the form" I'm not physically resizing it:  It's built in the designer and is roughly 500 x 500 but it's WindowState is set to "Maximize"

 

When you create the form like this:  Dim myForm as new TestForm - it "builds" the form using the same size as you did in your designer...this is where the top-panel in the RadLayoutControl is getting its height...but then the form "resizes" automatically because it's set to Maximum...and for some reason instead of resizing both panels (all panels?) in the RadLayoutControl, it only resizes the bottom panel.

 

Your work-around works perfectly and for that, I am once again thankful :)

Kindest regards,

Curtis Smith

 

0
Dimitar
Telerik team
answered on 26 Jun 2018, 07:46 AM
Hello Curtis,

I am glad that this works well now. We will consider improving it if we receive more requests for it. 

Do not hesitate to contact us if you have other questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
LayoutControl
Asked by
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dimitar
Telerik team
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or