I am comming in Windows programming from Web and here I met a strange problem:
- When I draw string on my TabPage like this:
int height = 50;
Graphics* gr = this->introductionTab->CreateGraphics();
RectangleF drawRectangle = RectangleF( 0, 10, this->tabControl->Width, height);
StringFormat* drawFormat = new StringFormat();
drawFormat->Alignment = StringAlignment::Center;
gr->DrawString(this->myString,new System:
rawing::Font(S"Verdana", 12, FontStyle::Bold),
Brushes::Black,drawRectangle,drawFormat);
If variable this->myString contains text that can be one line or many lines how can I get the real height? I mean that I set the height in my variable int height, but I would like to have height dynamicly generated by the length of the string. Is it possible to put somehow text on the stage and do not warry about how it is going to fit? What objects shall I use to perform that?
Thank you.
- When I draw string on my TabPage like this:
int height = 50;
Graphics* gr = this->introductionTab->CreateGraphics();
RectangleF drawRectangle = RectangleF( 0, 10, this->tabControl->Width, height);
StringFormat* drawFormat = new StringFormat();
drawFormat->Alignment = StringAlignment::Center;
gr->DrawString(this->myString,new System:
Brushes::Black,drawRectangle,drawFormat);
If variable this->myString contains text that can be one line or many lines how can I get the real height? I mean that I set the height in my variable int height, but I would like to have height dynamicly generated by the length of the string. Is it possible to put somehow text on the stage and do not warry about how it is going to fit? What objects shall I use to perform that?
Thank you.