We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I convert a Virtual, Physical, or Offset Position to a Client (or screen) Point?

Thread ID:

Created:

Updated:

Platform:

Replies:

118450 Mar 9,2015 07:52 PM Mar 12,2015 07:21 PM Windows Forms 3
loading
Tags: EditControl
Timothy N Tow
Asked On March 9, 2015 07:52 PM

Using the EditControl, we have the ability to get the CursorGraphicalLocation, which gives us a client Point that represents the location of the text cursor (the caret).
How then, can we convert a Syncfusion Virtual Position, Physical Position, or Offset to a "Graphical Location" that represents the corresponding location in a client Point?

I need to know the location of an text item at a given position, but I cannot determine what is the best method to accomplish this.  With a RichTextBox, you can simply use, GetPositionFromCharIndex(), but the EditControl does not seem to have any properties or methods that return the same information for a given offset or index.

Any help would be greatly appreciated! 

Saravanan T [Syncfusion]
Replied On March 10, 2015 04:24 PM

Hi Timothy,

Thank you for using Syncfusion products.

Query 1: How then, can we convert a Syncfusion Virtual Position, Physical Position, or Offset to a "Graphical Location" that represents the corresponding location in a client Point?

We can convert virtual position, physical position to a graphical position by using its function named “PointToClient” and Offset position can be converted to graphical position by using its function named “ConvertOffsetToVirtualPosition“.

We have also prepared a sample, Video for your reference and it can be downloaded from the following location.

Sample Location: http://www.syncfusion.com/downloads/support/directtrac/118450/Graphical_position1649243911.zip

Video Location: http://www.syncfusion.com/downloads/support/directtrac/118450/Graphical_location-1088097784.zip

Please refer below UG link for further reference.

UG Location: http://help.syncfusion.com/ug/windows%20forms/documents/positionsandoffsets.htm

Could you please look into this above solutions and let us know if it matches your requirements? Otherwise kindly share us more details about this requirement.

Query 2: I need to know the location of an text item at a given position, but I cannot determine what is the best method to accomplish this.

We are unable to understand this requirement clearly. Could you please explain us the purpose this requirement with more details? So that we can analyze and provide prompt solution as earlier as possible.

Please let us know if you need any further assistance,

Regards,

Saravanan T



Timothy N Tow
Replied On March 11, 2015 02:11 PM

Hi Timothy,

Thank you for using Syncfusion products.

Query 1: How then, can we convert a Syncfusion Virtual Position, Physical Position, or Offset to a "Graphical Location" that represents the corresponding location in a client Point?

We can convert virtual position, physical position to a graphical position by using its function named “PointToClient” and Offset position can be converted to graphical position by using its function named “ConvertOffsetToVirtualPosition“.

We have also prepared a sample, Video for your reference and it can be downloaded from the following location.

Sample Location: http://www.syncfusion.com/downloads/support/directtrac/118450/Graphical_position1649243911.zip

Video Location: http://www.syncfusion.com/downloads/support/directtrac/118450/Graphical_location-1088097784.zip

Please refer below UG link for further reference.

UG Location: http://help.syncfusion.com/ug/windows%20forms/documents/positionsandoffsets.htm

Could you please look into this above solutions and let us know if it matches your requirements? Otherwise kindly share us more details about this requirement.

Query 2: I need to know the location of an text item at a given position, but I cannot determine what is the best method to accomplish this.

We are unable to understand this requirement clearly. Could you please explain us the purpose this requirement with more details? So that we can analyze and provide prompt solution as earlier as possible.

Please let us know if you need any further assistance,

Regards,

Saravanan T



Thank you for your reply, but it does not exactly address my query.  Let me rephrase the question in less complicated terms.  How can I convert an offset to a Graphical Location?

In your example, virtual positions, physical positions, and offsets are converted to client points using the PointToClient() method, but those points do not represent the graphical location of the cursor.

You include a property of the EditControl, CursorGraphicalLocation, which is nice, but I need to be able to get the Graphical Location for a given offset.

So, I would like to know what the CursorGraphicalLocation of a particular offset would be.  If the cursor were at offset 25, I need to know what the CursorGraphicalLocation would be.  Basically, I would like to translate an offset (or virtual/physical position) to a Graphical Location.

Query 2 in my original post was just an explanation of how I would like to use this.  You can disregard it.

I have attached an updated sample which shows the CursorGraphicalLocation every time the cursor position changes.  As in the original sample, you can see the offset as well.  I would like to calculate the CursorGraphicalLocation value for a given offset, without actually changing the cursor position.

Thanks,
Timothy

Saravanan T [Syncfusion]
Replied On March 12, 2015 07:21 PM

Hi Timothy,

Sorry for the inconvenience caused,

We regret to let you know that currently we don’t have a support to convert from an offset to a Graphical location.

Please let us know if you need any further assistance on this,

Regards,

Saravanan T



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;