Hi,
i have WPF teechart control inside an ElementHost(in winforms application).
i want the TeeChart to invoke the AfterDraw event.
i tried to use DoInvalidate,Invalidate,InvalidateVisual, ... and ElementHost.Referesh, ElementHost.Invalidate... , but i can't make the event invoke.
When does the afterdraw event occur and how can i make it invoke inside an ElementHost?
WPF TeeChart with ElementHost
Re: WPF TeeChart with ElementHost
Hello MVUser6,
Can you please try to arrange a simple code because we can reproduce your problem here? On the other hand, you can try use Bitmap in winforms or BitmapSource in WPF to repaint as do in next lines of code:
or
Thanks,
Can you please try to arrange a simple code because we can reproduce your problem here? On the other hand, you can try use Bitmap in winforms or BitmapSource in WPF to repaint as do in next lines of code:
Code: Select all
Bitmap bmp = tChart1.Chart.Bitmap();
Code: Select all
BitmapSource bmp = tChart1.Chart.Bitmap();
Thanks,
Best Regards,
Sandra Pazos / 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: WPF TeeChart with ElementHost
Here is a sample project.
i want to somehow make the teechart call the afterdraw, with function call from the elementhost\the teechart itself.
i want to somehow make the teechart call the afterdraw, with function call from the elementhost\the teechart itself.
- Attachments
-
- TeeChartTestWithElementHost.rar
- (14.46 KiB) Downloaded 515 times
Re: WPF TeeChart with ElementHost
Hello MVUser6,
If you want TeeChart call AfterDraw Event, you must use the BitmapSource to achieve the Chart draw again. BitmapSource is behaved as bitmap and method Draw() of winforms. I have modified your button click event because the chart is repainted.
Does it work as you expect?
Thanks,
If you want TeeChart call AfterDraw Event, you must use the BitmapSource to achieve the Chart draw again. BitmapSource is behaved as bitmap and method Draw() of winforms. I have modified your button click event because the chart is repainted.
Code: Select all
public partial class Form1 : Form
{
private Steema.TeeChart.WPF.TChart TChartControl;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
InitTChartProperties();
}
private void InitTChartProperties()
{
this.SuspendLayout();
TChartControl = new Steema.TeeChart.WPF.TChart();
elementHost1.Visible = false;
this.pictureBox1.Controls.Add(this.elementHost1);
this.TChartControl.Aspect.View3D = false;
this.elementHost1.BackColor = System.Drawing.Color.Transparent;
this.elementHost1.Size = new System.Drawing.Size(916, 474);
this.TChartControl.TabIndex = 3;
Steema.TeeChart.WPF.Styles.Line line = new Steema.TeeChart.WPF.Styles.Line(TChartControl.Chart);
this.TChartControl[0].FillSampleValues();
this.TChartControl.AfterDraw = new Steema.TeeChart.WPF.PaintChartEventHandler(TChartControl_AfterDraw);
elementHost1.Child = TChartControl;
elementHost1.Dock = DockStyle.Fill;
this.ResumeLayout();
elementHost1.Visible = true;
}
void TChartControl_AfterDraw(object sender, Steema.TeeChart.WPF.Drawing.Graphics3D g)
{
richTextBox1.Text = "AfterDraw Invoked" Environment.NewLine;
}
private void button1_Click(object sender, EventArgs e)
{
elementHost1.Refresh();
BitmapSource bitmap = TChartControl.Chart.Bitmap();
}
Thanks,
Best Regards,
Sandra Pazos / 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 |