P
Peter O'Callaghan via .NET 247
(I tried to post this last week but I can't find it now, so Iappologies if it's on twice)
I am attempting to create a custom control for my CF application.This control should be able to incorporate a muliline headingand should also be able to be aligned either Left, Right orCenter. Now I can think of two ways of doing this. The first isby using a label, but since my application will contain alot ofcontrols, I feel this would give pretty high overheads. Theother way is to use DrawString.
Using DrawString however, there seems to be no options foralignment. I've even attempted to achieve the look by splitingthe string into lines, and calculating the position of each lineusing MeasureString to find its width. Using this method thecenter alignment looks good, but with Right align the edges donow line up as I expect them to. The only reason I can think offor this is somekind of rounding error, involved withMeasureString.
Has anyone got any idea how I can achieve a multiline, alignableheading without using a label?
I am attempting to create a custom control for my CF application.This control should be able to incorporate a muliline headingand should also be able to be aligned either Left, Right orCenter. Now I can think of two ways of doing this. The first isby using a label, but since my application will contain alot ofcontrols, I feel this would give pretty high overheads. Theother way is to use DrawString.
Using DrawString however, there seems to be no options foralignment. I've even attempted to achieve the look by splitingthe string into lines, and calculating the position of each lineusing MeasureString to find its width. Using this method thecenter alignment looks good, but with Right align the edges donow line up as I expect them to. The only reason I can think offor this is somekind of rounding error, involved withMeasureString.
Has anyone got any idea how I can achieve a multiline, alignableheading without using a label?