|
||||||
| Managed C++ Visual Studio .NET managed C++ Topics |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Code:
////////////////////////////////////////////////////////////
//** This returns the total number of lines the rich
//** text box can hold
////////////////////////////////////////////////////////////
private: int GetTotalNumberLines() {
String^ text = "TEST STRING";
System::Drawing::Font^ textFont = richTextBox1->Font;
//Specify a fixed width, but let the height be "unlimited"
SizeF^ layoutSize = gcnew SizeF((float)richTextBox1->Width,
(float)5000.0F);
Graphics^ g = Graphics::FromHwnd(richTextBox1->Handle);
SizeF^ stringSize = g->MeasureString(text, textFont, (SizeF)layoutSize);
// Divide RTB height by font height to determine how many it can hold.
int numLines = richTextBox1->Height / stringSize->Height;
// Return the number
return numLines;
}
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Floating Point random number generator | Paradine | PHP Tutorials | 0 | 08-26-2007 03:09 PM |
| Number Cloning | Ronin | Java Help | 3 | 12-21-2006 08:23 AM |
| Removing lines from a file | NeedHelp | C and C++ | 1 | 11-01-2006 01:10 PM |
| I need to generate a random number in PHP | dirkfirst | PHP Forum | 7 | 07-05-2006 10:58 PM |
| Number of files and directories in folder | dirkfirst | PHP Forum | 4 | 05-30-2006 11:06 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |