Displaying TChart on a GDI+ surface in design mode
-
- Newbie
- Posts: 6
- Joined: Fri Dec 02, 2005 12:00 am
- Contact:
Displaying TChart on a GDI+ surface in design mode
Hi,
I am trying to add a TChart to a GDI+ surface but have it appear in design mode. How can I achieve this?
I have a System.Drawing.Graphics object for the surface and I can do the following:
Bitmap image = TChart.Chart.Bitmap((int) rect.Width, (int) rect.Height);
g.DrawImage(image, (int)rect.X, (int)rect.Y);
But this displays the TChart in runtime mode.
Thanks,
James
I am trying to add a TChart to a GDI+ surface but have it appear in design mode. How can I achieve this?
I have a System.Drawing.Graphics object for the surface and I can do the following:
Bitmap image = TChart.Chart.Bitmap((int) rect.Width, (int) rect.Height);
g.DrawImage(image, (int)rect.X, (int)rect.Y);
But this displays the TChart in runtime mode.
Thanks,
James
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi James,
We don't understand what are you exactly trying to do, could you please give us more information and, if possible, send us an example project or some code snippet?
Thanks in advance.
We don't understand what are you exactly trying to do, could you please give us more information and, if possible, send us an example project or some code snippet?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 6
- Joined: Fri Dec 02, 2005 12:00 am
- Contact:
Displaying TChart on a GDI+ surface in design mode
Hi Narcís,
We are building a report designer. Users will be allowed to add a TChart to their reports. The reports themselves are displayed on the screen on a GDI+ drawing surface, not on a Windows Form. This is because we need to allow them to zoom and do various actions that are not possible on a Windows Form.
I see that the majority of users will be using TChart on Forms so will not encounter this problem.
I have a System.Drawing.Graphics object for the report and I need to add (using only code) a TChart to this surface. As I mentioned above I can do this with the lines:
TChart = new Steema.TeeChart.TChart();
Rectangle rect = GetPaintRectangle(); // local function which returns the rectangle to insert the chart
Bitmap image = TChart.Chart.Bitmap( rect.Width, rect.Height);
g.DrawImage(image, rect.X, rect.Y);
This shows the TChart on the GDI+ surface, but it is in runtime mode. This is fine for when we want to show the report in Preview mode, but we also want to be able to display the TChart in design mode. Is this possible without using Forms – using only our GDI+ drawing surface?
Thanks,
Martin
We are building a report designer. Users will be allowed to add a TChart to their reports. The reports themselves are displayed on the screen on a GDI+ drawing surface, not on a Windows Form. This is because we need to allow them to zoom and do various actions that are not possible on a Windows Form.
I see that the majority of users will be using TChart on Forms so will not encounter this problem.
I have a System.Drawing.Graphics object for the report and I need to add (using only code) a TChart to this surface. As I mentioned above I can do this with the lines:
TChart = new Steema.TeeChart.TChart();
Rectangle rect = GetPaintRectangle(); // local function which returns the rectangle to insert the chart
Bitmap image = TChart.Chart.Bitmap( rect.Width, rect.Height);
g.DrawImage(image, rect.X, rect.Y);
This shows the TChart on the GDI+ surface, but it is in runtime mode. This is fine for when we want to show the report in Preview mode, but we also want to be able to display the TChart in design mode. Is this possible without using Forms – using only our GDI+ drawing surface?
Thanks,
Martin
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Martin,
Have you tried using tChart1.Draw(Graphics g)? Do you have any problem using your code with this method?
Have you tried using tChart1.Draw(Graphics g)? Do you have any problem using your code with this method?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 6
- Joined: Fri Dec 02, 2005 12:00 am
- Contact:
Displaying TChart on a GDI+ surface in design mode
Narcís,
The problem with that approach is that I cannot seem to place the Chart where I would like on the GDI surface. It always appears at (0,0). I have tried using the Size and Location properties. Size works but Location doesn't.
// Below displays chart with correct size but always at 0,0
TChart.Size = new Size(rect.Width, rect.Height);
TChart.Location = new Point(rect.X, rect.Y);
TChart.Draw(g);
Martin
The problem with that approach is that I cannot seem to place the Chart where I would like on the GDI surface. It always appears at (0,0). I have tried using the Size and Location properties. Size works but Location doesn't.
// Below displays chart with correct size but always at 0,0
TChart.Size = new Size(rect.Width, rect.Height);
TChart.Location = new Point(rect.X, rect.Y);
TChart.Draw(g);
Martin
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 6
- Joined: Fri Dec 02, 2005 12:00 am
- Contact:
Displaying TChart on a GDI+ surface in design mode
Narcís,
Still appearing at 0,0
As an experiment I have another project which is a Windows form and these properties do work. It appears to be to do with the fact this is a GDI+ surface?
Martin
Still appearing at 0,0
As an experiment I have another project which is a Windows form and these properties do work. It appears to be to do with the fact this is a GDI+ surface?
Martin
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Martin,
Could you please send us an example we can run "as-is" to reproduce the problem here?
You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
Thanks in advance.
Could you please send us an example we can run "as-is" to reproduce the problem here?
You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 6
- Joined: Fri Dec 02, 2005 12:00 am
- Contact:
Displaying TChart on a GDI+ surface in design mode
Narcís,
Most of the code is copyrighted so I can't post as is, I will see if I can put something similar together for you instead though.
Thanks,
Martin
Most of the code is copyrighted so I can't post as is, I will see if I can put something similar together for you instead though.
Thanks,
Martin