Hi, there is problem in TeeChart Print Preview dialog. there is a Margin Units box, with items percent and 1/100 inch( by default ). If youl you'll try to change it to recent and back appears exception ( "A generic error occurred in GDI+." ). It looks like a bug.
Secondary i'd like to ask is there any way to avoid Generating Preview box, that blinks everytime i try to zoom preview size|?
Fail at printing preview.
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Fail at printing preview.
Petr wrote:Hi, there is problem in TeeChart Print Preview dialog. there is a Margin Units box, with items percent and 1/100 inch( by default ). If youl you'll try to change it to recent and back appears exception ( "A generic error occurred in GDI+." ). It looks like a bug.
This seems to work okay here using the following code:
Code: Select all
Surface series;
private void InitializeChart()
{
series = new Surface(tChart1.Chart);
series.FillSampleValues();
series.UseColorRange = false;
series.UsePalette = true;
series.PaletteStyle = PaletteStyles.Strong;
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Printer.Preview();
}
I'm afraid not.Petr wrote:Secondary i'd like to ask is there any way to avoid Generating Preview box, that blinks everytime i try to zoom preview size|?
Best Regards,
Christopher Ireland / 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 |
Re: Fail at printing preview.
Hi, after quiete long time i got this problem again. I attached simple project that demonstrates it.
- Attachments
-
- PrintProblem.rar
- (20.14 KiB) Downloaded 689 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Fail at printing preview.
Petr,
does that resolve the issue?
I've been able to reproduce this problem here, and I think this problem could be resolved with a code change in your code:Petr wrote:Hi, after quiete long time i got this problem again. I attached simple project that demonstrates it.
Code: Select all
m_PrintRect = new Rectangle( ev.MarginBounds.X, ev.MarginBounds.Y + (int)TitleSize.Height + marginFromTitle + 6 * (int)printFont.GetHeight() + 15, ev.MarginBounds.Width, (int)( ev.MarginBounds.Height * 0.3 ) );
//ev.Graphics.DrawImage( tChart1.Bitmap, ev.MarginBounds.X, ev.MarginBounds.Y + (int)TitleSize.Height + marginFromTitle + 6 * (int)printFont.GetHeight() + 15, ev.MarginBounds.Width, 300 );
//ev.Graphics.DrawImage( tChart1.Bitmap, m_PrintRect );
AdjustRectangle(ref m_PrintRect);
System.Drawing.Imaging.Metafile m = tChart1.Chart.Metafile( tChart1.Chart, m_PrintRect.Width, m_PrintRect.Height );
private void AdjustRectangle(ref Rectangle rect)
{
int top = rect.Top;
int left = rect.Left;
int width = rect.Width;
int height = rect.Height;
if (width < 0 && left + width >= 0)
{
rect.X += width;
rect.Width = Math.Abs(width);
}
if (height < 0 && top + height >= 0)
{
rect.Y += height;
rect.Height = Math.Abs(height);
}
}
does that resolve the issue?
Best Regards,
Christopher Ireland / 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 |
Re: Fail at printing preview.
Yes, thank you, that works.