/// <summary> /// measures the width of the strings built by the display of a column and /// returns the maximumn width found. /// NOTE: you may need to add a small (e.g. under 10-pixel) margin to prevent wrapping in most cases. /// </summary> /// <returns>width in pixels</returns> public int GetColumnContentsWidth(int icolChanged) { // Review: This WaitCursor doesn't seem to work. Anyone know why? using (new WaitCursor()) { using (Graphics g = Graphics.FromHwnd(Handle)) { // get a best estimate to determine row needing the greatest column width. MaxStringWidthForChartColumn env = new MaxStringWidthForChartColumn(m_vc, m_styleSheet, Cache.MainCacheAccessor, m_hvoChart, g, icolChanged); Cache.EnableBulkLoadingIfPossible(true); try { Vc.Display(env, m_hvoChart, ConstChartVc.kfragChart); } finally { Cache.EnableBulkLoadingIfPossible(false); } return env.MaxStringWidth; } } }
// Couldn't figure out how to get these to work for my bracketing problem. // Will try something else. -- GJM 16 Sep 2011 ///// <summary> ///// Right-to-Left Embedding mark to start embedded right-to-left. ///// We use it for things that aren't otherwise recognized as RTL. ///// </summary> //internal char RLE = '\x202B'; ///// <summary> ///// Pop Directional Formatting mark to end embedded right-to-left. ///// </summary> //internal char PDF = '\x202C'; /// <summary> /// measures the width of the strings built by the display of a column and /// returns the maximumn width found. /// NOTE: you may need to add a small (e.g. under 10-pixel) margin to prevent wrapping in most cases. /// </summary> /// <returns>width in pixels</returns> public int GetColumnContentsWidth(int icolChanged) { // Review: This WaitCursor doesn't seem to work. Anyone know why? using (new WaitCursor()) { using (var g = Graphics.FromHwnd(Handle)) { // get a best estimate to determine row needing the greatest column width. var env = new MaxStringWidthForChartColumn(m_vc, m_styleSheet, Cache.MainCacheAccessor, m_hvoChart, g, icolChanged); Vc.Display(env, m_hvoChart, ConstChartVc.kfragChart); return env.MaxStringWidth; } } }