Page 1 of 1

Converting brush images from old TChart

Posted: Mon Jan 19, 2009 4:19 pm
by 14045174
I have written my utility to convert old Win32 TChart templates into .NET format. So far I have one (as far as I know) outstanding issue. In Win32 brushes could have a pattern set to use an image, which was kind of default image (the extra selections on your left, like "zigzag"). I can save this image and reload it to .NET, but then it is treated as a real image, so my color selections are not applied. From other side, the .NET version does have all these selections available on the Hutch page, so if I only knew, which one was selected... So, here is my question: does anyone know, how to figure out if the image assigned to a brush is one of the TChart predefined ones, and if so - which one?

Help is greatly appreciated.

Posted: Tue Jan 20, 2009 12:35 pm
by narcis
Hi UserLS,

I'm afraid this is not possible. TeeChart VCL serializes those images as binary data, for example:

Code: Select all

    Brush.Image.Data = {
      07544269746D61707E000000424D7E000000000000003E000000280000001000
      0000100000000100010000000000400000000000000000000000020000000200
      000000000000FFFFFF007DF70000BAEB0000D75D0000EFBE00007DF70000BAEB
      0000D75D0000EFBE00007DF70000BAEB0000D75D0000EFBE00007DF70000BAEB
      0000D75D0000EFBE0000}
You can get this data into a string and use something like code below to convert Base64 string into an image.

Code: Select all

			byte[] brushData = System.Convert.FromBase64String(tmpStr);
			System.IO.MemoryStream tmpStream = new System.IO.MemoryStream(brushData);
			Bitmap bmp = (Bitmap)Bitmap.FromStream(tmpStream);
Hope this helps!