I'm having a bad day with SplitContainers. This is the first time I've used them in an application, and I've been running into problems nonstop.
My program is set up like this: I have one SplitContainer with a panel and another SplitContainer so that I have 3 windows: One main, bigger window and two smaller windows, all of which need to be adjustable.
Inside each of these windows I will be drawing graphics (using System.Graphics).
Now, the issues:
1. I can't draw in the SplitContainer panels past the dimensions that they had originally. I was trying to draw axis in each of the panels, but the lines would never draw past the original dimensions when the splitter was moved and the panels were resized.
2. I have a sub that handles the SplitterMove event for each SplitContainer, so that the same code is executed whenever either splitter is moved. However, this doesn't seem to be working. When I move the main splitter and redraw, nothing is redrawn in one of the other panels. I can't figure out why because the exact same code produces the results I want when it is executed from a button.
Here's the code I'm using for drawing lines:
And here's the code I'm using for calculating the values in the block above:
My program is set up like this: I have one SplitContainer with a panel and another SplitContainer so that I have 3 windows: One main, bigger window and two smaller windows, all of which need to be adjustable.
Inside each of these windows I will be drawing graphics (using System.Graphics).
Now, the issues:
1. I can't draw in the SplitContainer panels past the dimensions that they had originally. I was trying to draw axis in each of the panels, but the lines would never draw past the original dimensions when the splitter was moved and the panels were resized.
2. I have a sub that handles the SplitterMove event for each SplitContainer, so that the same code is executed whenever either splitter is moved. However, this doesn't seem to be working. When I move the main splitter and redraw, nothing is redrawn in one of the other panels. I can't figure out why because the exact same code produces the results I want when it is executed from a button.
Here's the code I'm using for drawing lines:
VB.NET:
Public Sub Draw_Axis()
gxy.DrawLine(Pens.Red, 0, PanelCenters(0).Y, spPnl1.Panel1.Width, PanelCenters(0).Y)
gxy.DrawLine(Pens.Green, PanelCenters(0).X, 0, PanelCenters(0).X, spPnl1.Panel1.Height)
gxz.DrawLine(Pens.Red, 0, PanelCenters(1).Y, spPnl2.Panel1.Width, PanelCenters(1).Y)
gxz.DrawLine(Pens.Blue, PanelCenters(1).X, 0, PanelCenters(1).X, spPnl2.Panel1.Height)
gzy.DrawLine(Pens.Blue, 0, PanelCenters(2).Y, spPnl2.Panel2.Width, PanelCenters(2).Y)
gzy.DrawLine(Pens.Green, PanelCenters(2).X, 0, PanelCenters(2).X, spPnl2.Panel2.Height)
End Sub
And here's the code I'm using for calculating the values in the block above:
VB.NET:
Public Sub Define_Centers()
'Define the centers of each panel.
PanelCenters(0).X = spPnl1.Panel1.Width / 2
PanelCenters(0).Y = spPnl1.Panel1.Height / 2
PanelCenters(1).X = spPnl2.Panel1.Width / 2
PanelCenters(1).Y = spPnl2.Panel1.Height / 2
PanelCenters(2).X = spPnl2.Panel2.Width / 2
PanelCenters(2).Y = spPnl2.Panel2.Height / 2
End Sub