3 Replies - 468 Views - Last Post: 15 August 2012 - 03:52 PM Rate Topic: -----

#1 ts859  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 18-May 12

get Point from CharacterIndex ?

Posted 15 August 2012 - 04:31 AM

Im using a custom caret in a WPF textbox, I want to get the Point(x,y) from the characterIndex or the caretIndex. There is a way to convert a point(x,y) to a characterIndex (getCharacterIndexfromPoint) but is there a way to do the other way round?
Is This A Good Question/Topic? 0
  • +

Replies To: get Point from CharacterIndex ?

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3589
  • View blog
  • Posts: 11,161
  • Joined: 05-May 12

Re: get Point from CharacterIndex ?

Posted 15 August 2012 - 04:53 AM

Stop. Think. What point is supposed to be return for a given character at character index? The top left corner, the bottom right corner. The center of the character? If the center and the character is left leaning like an 'L', should the point be in the vertical part of the 'L', as opposed to the right side of a lowercase 'd'?

Anyway, it looks like Intellisense has failed you again. Sometimes, it pays to look at the documentation. In there, you'll find GetRectFromCharacterIndex(): http://msdn.microsof...mcharacterindex
Was This Post Helpful? 3
  • +
  • -

#3 ts859  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 18-May 12

Re: get Point from CharacterIndex ?

Posted 15 August 2012 - 12:35 PM

Thanks a lot! It worked!
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3589
  • View blog
  • Posts: 11,161
  • Joined: 05-May 12

Re: get Point from CharacterIndex ?

Posted 15 August 2012 - 03:52 PM

Cool! It would be great if you update the other thread where you asked about caret alternatives and put a little update on your approach. Or even better, write a small tutorial on how to do a custom caret in the WPF TextBox. That should get you some DIC Kudos points. :lol:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1