Converting brush images from old TChart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Converting brush images from old TChart

Post by UserLS » Mon Jan 19, 2009 4:19 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jan 20, 2009 12:35 pm

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply