Board index » Visual Studio » Resizing a pane in a CStatusBar to fit the text I want to display
|
ROconnor
|
Resizing a pane in a CStatusBar to fit the text I want to display
Visual Studio100
I want the width of the pane in a CStatus Bar to be dynamic and resize based on the string it is displaying. Visual Studio 6 has this behavior in its status bar where the Line and Column number are displayed. I see how to change the width of the pane using the SetPaneInfo method. My question is how to calculate the width. If I have the string, how do I know what width to set? Does it depend on the resolution of the screen displaying the APP (experimentation shows it is not)? Does it depend on the font used in the window and is this derived from the Desktop Display settings? In a perfect world there would be a method I could call that returned the width (in the units that SetPaneInfo requires) that took a character string as an input. E.G. int width = CWND::WidthOfString("this is the string to display"); m_wnd.SetPaneInfo(index,id,style, width); - |
