Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have figured out as to how to get this working. So, in case people want to know how to implement this in their programs can get an idea from this code.</p> <p>Code:</p> <pre><code>void CRangemasterGeneratorDlg::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default GetCursorPos(&amp;point); int mx = point.x; int my = point.y; float cursR, cursH; cursR = (mx - 312) / 7.2;// records the current cursor's radius(x) position cursH = (641 - my) / 5.3;// records the current cursor's height(y) position CString Hgt,Rds; Hgt.Format("%.3f",cursH);// Rounding off Height values to 3 decimal places Rds.Format("%.3f",cursR);// Rounding off Radius values to 3 decimal places curR = (float)atof(Rds); curH = (float)atof(Hgt); // I had limits on my grid from 0 - 100 on both x and y-axis if(curR &lt; 0 || curR &gt;100 || curH &lt; 0 || curH &gt; 100) return; SetCapture(); SetCursor(::LoadCursor(NULL, IDC_CROSS)); //snap the point, compare the point with your array and save position on 'y' for(int i=0; i &lt; 100; i++) { if(curH &lt; m_Points[i+1].m_height_point &amp;&amp; curH &gt;m_Points[i-1].m_height_point) { curH = m_Points[i].m_height_point; curR = m_Points[i].m_radius_point; y = i; } } CDialog::OnRButtonDown(nFlags, point); UpdateData(false); Invalidate(); } void CRangemasterGeneratorDlg::OnRButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default ReleaseCapture(); GetCursorPos(&amp;point); int mx1 = point.x; int my1 = point.y; float curR1,curH1; curR1 = (mx1 - 312) / 7.2;// records the current cursor's radius(x) position curH1 = (641 - my1) / 5.3;// records the current cursor's height(y) position m_Points[y].m_radius_point = curR1; m_Points[y].m_height_point = curH1; Invalidate(); CDialog::OnRButtonUp(nFlags, point); UpdateData(false); } </code></pre> <p>...</p> <p>I have ran this code and it works brilliantly well. The variables in this code are pertaining to the ones that I have used in my program. In case you don't understand, feel free to ask me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload