Profile Picture

Mouse Hit Test and NPaintCallback

Posted By Raul Kist 13 Years Ago
Author
Message
Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
With the next major version of the Chart control we will implement Custom Paint Series for 2D.

Best Regards,
Nevron Support Team



Raul Kist
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 6, Visits: 1
I do think so =]

Anything that allows me to order the painting or the layers.

Another good thing is the possibility to identify what are you painting with a HitTest (it always return Axis).

This kind of thing allows one to build custom and more complex interactions on the charts.


Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Raul,

We see - we're currently thinking to introduce a custom paint series - this will allow you to hook the painting before or after the build in series - will that help?



Best Regards,
Nevron Support Team



Raul Kist
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 6, Visits: 1
Sure =]

But it disappears as I draw more stuff in the chart (in the wall).



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Raul,

Did you try to move the code in BeforePaint?



Best Regards,
Nevron Support Team



Raul Kist
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 6, Visits: 1
The problem is that if I draw something using a "public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)" from NPaintCallback the HitTest always returns a Axis as result.

This way I can't know what am I clicking on.

I already solved this using this code to calculate if the point is In or Out the polygon:

private static bool pointInPolygon(PointF point, List polygon)
{
int polySides = polygon.Count;
float x = point.X;
float y = point.Y;
int i, j = polySides - 1;
bool oddNodes = false;

for (i = 0; i < polySides; i++)
{
if ((polygon[i].Y < y && polygon[j].Y >= y || polygon[j].Y < y && polygon[i].Y >= y) && (polygon[i].X <= x || polygon[j].X <= x))
{
if (polygon[i].X + (y - polygon[i].Y) / (polygon[j].Y - polygon[i].Y) * (polygon[j].X - polygon[i].X) < x)
{
oddNodes = !oddNodes;
}
}
j = i;
}

return oddNodes;
}

The problem I'm having now is how to make the chart data appear over the OnAfterPaint drawn polygon...

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Raul,

Can you post the code you're currently using?



Best Regards,
Nevron Support Team



Raul Kist
w00t Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 6, Visits: 1
Hi!

Does anyone knows how can I get a Hit Test result different from Axis when clicking over a NPaintCallback drawn polygon?

Or how can I identify this polygon without having to calculate if the mouse is inside or outside?

Thanks a lot =]
Raul Kist



Similar Topics


Reading This Topic