Click here to Skip to main content
15,891,372 members
Home / Discussions / C#
   

C#

 
GeneralRe: Distributed Applications Pin
hosam Taji16-Jun-07 1:14
hosam Taji16-Jun-07 1:14 
GeneralRe: Distributed Applications Pin
Expert Coming16-Jun-07 2:01
Expert Coming16-Jun-07 2:01 
QuestionWhat library to use for Video and Text in real time. Pin
Manaxter16-Jun-07 0:02
Manaxter16-Jun-07 0:02 
AnswerRe: What library to use for Video and Text in real time. Pin
Ed.Poore16-Jun-07 5:08
Ed.Poore16-Jun-07 5:08 
GeneralRe: What library to use for Video and Text in real time. Pin
Manaxter16-Jun-07 12:24
Manaxter16-Jun-07 12:24 
GeneralRe: What library to use for Video and Text in real time. Pin
Ed.Poore16-Jun-07 21:40
Ed.Poore16-Jun-07 21:40 
QuestionRichTextBox problem Pin
cygnusx198615-Jun-07 22:56
cygnusx198615-Jun-07 22:56 
AnswerRe: RichTextBox problem Pin
giddy_guitarist16-Jun-07 7:56
giddy_guitarist16-Jun-07 7:56 
hi ,

The only way , according to me atleast , to do that would be to get the word the mouse pointer is on , and then change the word.


1.You get the position of the mouse by handling the MouseMove and MouseDown events from the richtxtbox.

2.The Richtextbox class has a GetCharIndexFromPosition(Point) method, which takes a point. You can suppy the mouse position there

3.Once you get the char index , use the text property and loop first backward , then forward , till you get a space , that should give you the index positions for the word. If then , the word is the one you're after , select it , and set its font and color.

struct Word<br />
{<br />
 public string Text;<br />
 public int StartPos;<br />
 public int EndPos;<br />
}<br />
Point pt;<br />
//get mouse points from the mouse down/move events<br />
int p = richTextBox.GetCharIndexFromPosition(pt);<br />
Word GetWordFromIndex()<br />
{<br />
int i=p;<br />
while(true)<br />
{<br />
 if(richtextbox.Text[i--]==' '||i==0) break;<br />
  <br />
}<br />
Word wd = new Word();<br />
wd.StartPos = i<br />
i=p;<br />
while(true)<br />
{<br />
 if(richtextbox.Text[i++]==' '||i==0) break;<br />
  <br />
}<br />
wd.EndPos = i;<br />
wd.Text = richtextbox.Text.Substring(wd.SatartPos , (wd.EndPos-wd.StartPos));<br />
return wd;<br />
}<br />

You could then check if the Word.Text is what you we're looking for , and if it is , you can change the Font by setting the SelectedText property to the text , then changing the selectionFont and SelectionColor properties.

Hope i helped

Gideon
AnswerRe: RichTextBox problem Pin
Hesham Yassin20-Jun-07 0:24
Hesham Yassin20-Jun-07 0:24 
QuestionHow To Merge Columns in DataGridView ..? Pin
Pankaj - Joshi15-Jun-07 22:46
Pankaj - Joshi15-Jun-07 22:46 
AnswerRe: How To Merge Columns in DataGridView ..? [modified] Pin
mashisuke15-Jun-07 23:35
mashisuke15-Jun-07 23:35 
GeneralRe: How To Merge Columns in DataGridView ..? Pin
Pankaj - Joshi15-Jun-07 23:50
Pankaj - Joshi15-Jun-07 23:50 
GeneralRe: How To Merge Columns in DataGridView ..? Pin
Expert Coming16-Jun-07 0:46
Expert Coming16-Jun-07 0:46 
QuestionAssign Value in DropDownList type Combo Box Pin
Pankaj - Joshi15-Jun-07 22:25
Pankaj - Joshi15-Jun-07 22:25 
AnswerRe: Assign Value in DropDownList type Combo Box Pin
Luc Pattyn15-Jun-07 22:50
sitebuilderLuc Pattyn15-Jun-07 22:50 
GeneralRe: Assign Value in DropDownList type Combo Box Pin
Pankaj - Joshi15-Jun-07 23:47
Pankaj - Joshi15-Jun-07 23:47 
QuestionHow we get User active status in Activ directory Pin
ASysSolvers15-Jun-07 22:18
ASysSolvers15-Jun-07 22:18 
QuestionHow to bring whole word to next line Pin
Hum Dum15-Jun-07 22:07
Hum Dum15-Jun-07 22:07 
AnswerRe: How to bring whole word to next line Pin
Vasudevan Deepak Kumar16-Jun-07 1:57
Vasudevan Deepak Kumar16-Jun-07 1:57 
AnswerRe: How to bring whole word to next line Pin
Hesham Yassin20-Jun-07 0:26
Hesham Yassin20-Jun-07 0:26 
QuestionGetting unhandled exception in runtime Pin
beatles169215-Jun-07 21:24
beatles169215-Jun-07 21:24 
AnswerRe: Getting unhandled exception in runtime Pin
Christian Graus15-Jun-07 22:01
protectorChristian Graus15-Jun-07 22:01 
GeneralRe: Getting unhandled exception in runtime Pin
beatles169215-Jun-07 22:22
beatles169215-Jun-07 22:22 
GeneralRe: Getting unhandled exception in runtime Pin
Colin Angus Mackay16-Jun-07 0:41
Colin Angus Mackay16-Jun-07 0:41 
GeneralRe: Getting unhandled exception in runtime Pin
beatles169216-Jun-07 0:59
beatles169216-Jun-07 0:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.