Wednesday, May 2, 2012

Convert listBox.SelectedItem to PointF

I have an item in my listbox;
I want to take it and convert it to PointF so that I can compare it with a list of pointF.



Example)
var selection = listBox3.SelectedItem ; // like "{X=18,Y=48.10001}"



PointF p1 = (PointF) selection;



//now when that item has been selected and converted to float point, I want to search and find it in list called optFlowPoints to see if that points exists



PointF drawPointEst=optFlowPonits.Find(p=>p.Equals(selection));



So there are two problems:




  1. how to convert selectedItem to PointF

  2. how to write my lambda expression to find the match





No comments:

Post a Comment