I've just upgraded HtmlRenderer from version 1.4 to the latest 1.5.0.5. I immediately got the problem that instances of HtmlLabel rendered wrong all over my application when I run it in debug mode through Visual Studio 2010. If I run the application outside (still the debug build), it works fine. I traced this down to the an issue in the layout, where the method Win32Utils.GetTextMetrics (in GraphicsAdapter.MeasureString) throws an exception.
Looking at the declarations in Win32Utils, I made the following changes, which solved my problems:
```
[DllImport("gdi32.dll", EntryPoint = "GetTextMetricsW", CharSet = CharSet.Unicode)]
public static extern bool GetTextMetrics(IntPtr hdc, out TextMetric lptm);
```
```
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct TextMetric
{
public int tmHeight;
...
```
I did try to make a small test application to illustrate the problem, but that did however not exhibit this behavior. Also, I 'only' did the test on one computer, running Windows 7, 64 bit.
I hope this makes sense to you and that these or similar changes can be incorporated in the official build of HtmlRenderer.
Last, but not least, thanks for a great library. I look forward to working with all the new features.
Comments: very strange.. maybe its a bug in VS 2010... well, I think it is safe to say the library will only run on Unicode supported OS, so I added it explicitly to all text related functions. thx for your help.
Looking at the declarations in Win32Utils, I made the following changes, which solved my problems:
```
[DllImport("gdi32.dll", EntryPoint = "GetTextMetricsW", CharSet = CharSet.Unicode)]
public static extern bool GetTextMetrics(IntPtr hdc, out TextMetric lptm);
```
```
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct TextMetric
{
public int tmHeight;
...
```
I did try to make a small test application to illustrate the problem, but that did however not exhibit this behavior. Also, I 'only' did the test on one computer, running Windows 7, 64 bit.
I hope this makes sense to you and that these or similar changes can be incorporated in the official build of HtmlRenderer.
Last, but not least, thanks for a great library. I look forward to working with all the new features.
Comments: very strange.. maybe its a bug in VS 2010... well, I think it is safe to say the library will only run on Unicode supported OS, so I added it explicitly to all text related functions. thx for your help.