| View previous topic :: View next topic |
| Author |
Message |
Analian Guest
|
Posted: Tue Mar 29, 2005 8:55 am Post subject: Incorrect resize |
|
|
I've got a Panel with two Charts in it
I want Chart3 to stay on the bottom of Panel3 and with subsequent clicks of
Button1 to change Chart2's states
between visible and invisible. Thus I want the Panel to resize and shrink to
Chart2's Height when Chart3's invisible and then go back to the Height of
both Charts when both are visible.
The following code I guess is supposed to change the Height of the panel and
preserve the desired alignment of the
two Charts but something's not ok. Any ideas on this matter? Thank you.
void TForm1::HideChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 0;
Panel3->Height = Chart3->Height + 2 * Panel3->BevelWidth;
Chart3->Align = alBottom;
Chart2->Align = alClient;
}
void TForm1::ShowChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 1;
Panel3->Height = Chart3->Height + Chart2->Height + 2 *
Panel3->BevelWidth;
Chart3->Align = alBottom;
Chart2->Align = alClient;
Chart2->Top = 0;
Chart3->Top = Chart2->Height;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (Chart2->Visible)
HideChart();
else
ShowChart();
}
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Mar 29, 2005 9:22 am Post subject: Re: Incorrect resize |
|
|
Analian wrote:
| Quote: | I've got a Panel with two Charts in it
I want Chart3
|
Please use Chart1 and Chart2 if you have two of them.
| Quote: | to stay on the bottom of Panel3 and with subsequent clicks of
Button1 to change Chart2's states
between visible and invisible. Thus I want the Panel to resize and shrink to
Chart2's Height when Chart3's invisible and then go back to the Height of
both Charts when both are visible.
The following code I guess is supposed to change the Height of the panel and
preserve the desired alignment of the
two Charts but something's not ok.
|
Please tell us first what is not ok.
| Quote: | Any ideas on this matter? Thank you.
void TForm1::HideChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 0;
|
Chart2->Visible = false;
| Quote: | Panel3->Height = Chart3->Height + 2 * Panel3->BevelWidth;
Chart3->Align = alBottom;
Chart2->Align = alClient;
|
Do not toucht the alignment of Chart2. It is not even visible!
| Quote: | }
void TForm1::ShowChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 1;
|
Chart2->Visible = true;
| Quote: | Panel3->Height = Chart3->Height + Chart2->Height + 2 *
Panel3->BevelWidth;
|
Here you take Chart2->Height were it was first aligned alBottom
and then al None. What do you expect it's Heigth to be now ?
| Quote: | Chart3->Align = alBottom;
Chart2->Align = alClient;
Chart2->Top = 0;
Chart3->Top = Chart2->Height;
|
Only the first two of these fout statements should do.
But why all these aligning ? Just change the Top of the lower
Chart. That's all.
Hans.
|
|
| Back to top |
|
 |
|