allow the control to move with panning


Author
Message
Enjoyear Guo
Enjoyear Guo
Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)
Group: Forum Members
Posts: 30, Visits: 1
I add a textbox control to the nChartControl1 as follows:
NTextBox textBox = new NTextBox();
textBox.Location = new Point(10,10);
textBox.Size = new Size(100,100);
nChartControl1.Controls.Add(textBox);
However, if I try to pan the chart left/right, the textbox control will always stays at the same place. Is it possible to allow it to move with panning.

Thank you.

Enjoyear

Reply
Enjoyear Guo
Enjoyear Guo
Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)
Group: Forum Members
Posts: 30, Visits: 1
Hi,
I am using the following way to solve my problem.

NScale2DToViewTransformation scaleToView =
new NScale2DToViewTransformation(nChartControl1.View.Context,
modelView.GetChartControl().Charts[0],
(int) StandardAxis.PrimaryX, (int) StandardAxis.PrimaryY);
NPointF point = new NPointF();
scaleToView.Transform(new NVector2DD(positionDataX, positionDataY), ref point);
TextBox.Location = new Point((int) point.X - TextBox.Size.Width/2, (int) point.Y + 5);




This could basically solve my problem when I call this method within the MouseMove event. But there is a small problem.
If the user is panning the chart too quickly(throw the chart left/right), then the position of the textbox could not updated when the mouse is released. Same problem will happen if the user zoomed into the chart. The textbox will still stay at the original place. I think the problem might be the nChartControl1.View.Context is not updated when I call the method above when the mouse is released.

So my question is:
Is there any event that will be raised if nChartControl1.View.Context is updated or the chart is shown?

Acutally, I found an event, which is nChartControl1.Paint. But I cannot figure out when this event is raised.
Thank you very much.

Enjoyear
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search