3 Answers, 1 is accepted
0
Hi Andre,
The default behavior of RadPanorama is to use the CellSize property to control tile width and height. You can sync this property with RadPanorama size by handling its SizeChanged even like demonstrated below:
I hope this helps.
Kind regards,
Jack
the Telerik team
The default behavior of RadPanorama is to use the CellSize property to control tile width and height. You can sync this property with RadPanorama size by handling its SizeChanged even like demonstrated below:
Size originalSize;
Size originalCellSize;
originalSize = panorama.Size;
originalCellSize = panorama.CellSize;
panorama.SizeChanged +=
new
EventHandler(panorama_SizeChanged);
void
panorama_SizeChanged(
object
sender, EventArgs e)
{
SizeF delta =
new
SizeF((
float
)panorama.Size.Width / (
float
)originalSize.Width, (
float
)panorama.Size.Height / (
float
)originalSize.Height);
panorama.PanoramaElement.CellSize =
new
System.Drawing.Size(
(
int
)(originalCellSize.Width * delta.Width),
(
int
)(originalCellSize.Height * delta.Height));
}
I hope this helps.
Kind regards,
Jack
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Andre
Top achievements
Rank 1
answered on 26 Jan 2013, 02:53 AM
Thanks, the above is what i ended up doing originally. It got a little crazy when the user was allowed to reposition things. I've ended up simply centering the control in the window at a fixed size.
Ideally i would like to have the controls width to resize, and have the groups centered. Is there a way to automatically center the groups?
Ideally i would like to have the controls width to resize, and have the groups centered. Is there a way to automatically center the groups?
0
Hi Andre,
The solution from my previous post works when there are no groups in RadPanorama. Consider the following code which works when using groups:
The same applies on the case when centering tiles. The difference is that you should arrange GroupLayout instead of TileLayout. Consider the code below:
I hope this helps.
Regards,
Jack
the Telerik team
The solution from my previous post works when there are no groups in RadPanorama. Consider the following code which works when using groups:
void
panorama_SizeChanged(
object
sender, EventArgs e)
{
SizeF delta =
new
SizeF((
float
)panorama.Size.Width / (
float
)originalSize.Width, (
float
)panorama.Size.Height / (
float
)originalSize.Height);
foreach
(TileGroupElement tileGroup
in
panorama.Groups)
{
tileGroup.CellSize =
new
System.Drawing.Size(
(
int
)(originalCellSize.Width * delta.Width),
(
int
)(originalCellSize.Height * delta.Height));
}
}
The same applies on the case when centering tiles. The difference is that you should arrange GroupLayout instead of TileLayout. Consider the code below:
public
class
CustomPanorama : RadPanorama
{
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadPanorama).FullName;
}
set
{ }
}
protected
override
RadPanoramaElement CreatePanoramaElement()
{
return
new
CustomPanoramaElement();
}
}
public
class
CustomPanoramaElement : RadPanoramaElement
{
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(RadPanoramaElement);
}
}
protected
override
SizeF ArrangeOverride(SizeF finalSize)
{
base
.ArrangeOverride(finalSize);
this
.GroupLayout.Arrange(
new
RectangleF(0,
(finalSize.Height -
this
.GroupLayout.DesiredSize.Height) / 2,
this
.GroupLayout.DesiredSize.Width,
this
.GroupLayout.DesiredSize.Height));
return
finalSize;
}
}
I hope this helps.
Regards,
Jack
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.