Setting properties of a Split Container at form load

Topics related to the Krypton Toolkit.

Moderators: Phil Wright, Chris Porter

Setting properties of a Split Container at form load

Postby CompSci » Mon Dec 27, 2010 4:43 am

I created an example ribbon project just to make sure, but if I try and set a split container properties at form load with the same code as I use at run time the panels controls disappear.

Any suggestions? The goal is to use my.settings to persist the panel open or closed.


Private Sub ButtonSpecHeaderGroup1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kbshgLists.Click

KryptonSplitContainer1.SuspendLayout()


If My.Settings.ListPanelOpen = True Then

KryptonSplitContainer1.Panel1MinSize = 25
KryptonSplitContainer1.SplitterDistance = 25
khgLists.HeaderPositionPrimary = VisualOrientation.Left
khgLists.ButtonSpecs(0).Edge = PaletteRelativeEdgeAlign.Far
kbshgLists.Type = PaletteButtonSpecStyle.ArrowLeft
My.Settings.ListPanelOpen = False

Else

KryptonSplitContainer1.Panel1MinSize = 175
KryptonSplitContainer1.SplitterDistance = 175
khgLists.HeaderPositionPrimary = VisualOrientation.Top
khgLists.ButtonSpecs(0).Edge = PaletteRelativeEdgeAlign.Far
kbshgLists.Type = PaletteButtonSpecStyle.ArrowRight
My.Settings.ListPanelOpen = True

End If

KryptonSplitContainer1.ResumeLayout()

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'KryptonSplitContainer1.IsSplitterFixed = True

'KryptonSplitContainer1.Panel1MinSize = 25
'KryptonSplitContainer1.SplitterDistance = 25
'khgLists.HeaderPositionPrimary = VisualOrientation.Left
'khgLists.ButtonSpecs(0).Edge = PaletteRelativeEdgeAlign.Far
'kbshgLists.Type = PaletteButtonSpecStyle.ArrowRight
'My.Settings.ListPanelOpen = False


End Sub
Attachments
splitpaneltest.png
splitpaneltest.png (21.07 KiB) Viewed 434 times
CompSci
 
Posts: 41
Joined: Tue Nov 17, 2009 5:23 am

Re: Setting properties of a Split Container at form load

Postby StefanKoell » Sat Jan 01, 2011 10:14 pm

You should set this kind of stuff in the constructor (after the InitializeComponents method). In the Form load event each control got already a window handle whereas handling this stuff in the constructor (like the designer handles this) is much more efficient because the layout engine doesn't do anything at this time.
Stefan

http://www.code4ward.net
Home of Royal TS and LogSmith, of course Kryptonized!
StefanKoell
 
Posts: 88
Joined: Sun Oct 26, 2008 7:15 pm
Location: Austria

Re: Setting properties of a Split Container at form load

Postby CompSci » Sat Jan 08, 2011 11:56 pm

I have tried your suggestion and the result is the same. All controls are still invisible. Any other suggestions?
CompSci
 
Posts: 41
Joined: Tue Nov 17, 2009 5:23 am

Re: Setting properties of a Split Container at form load

Postby Edgar Ferreira » Mon Jan 10, 2011 7:50 pm

I had a similar behavior in same of my KryptonForms.
The only way I found out to solve it was enabling a timer on FormLoad and then refresh the controls inside the timer event.
Edgar Ferreira
 
Posts: 132
Joined: Thu Mar 26, 2009 8:59 pm
Location: Coimbra, Portugal


Return to Krypton Toolkit

Who is online

Users browsing this forum: Google [Bot] and 2 guests