How to change the color of the text
I am a starter. Iam a creating a pad almost like notpad in windows.
i need to change the color of the text. I used ChooseColor function to get the color from the color dialog box. how can i make the text that is typed there forth to appear in the color that is selected in the color dialog??
Some body help me
Thanks in advance
# 1 Re: How to change the color of the text
Well...what control are you using? Rich-Edit?
# 2 Re: How to change the color of the text
Hi
Let say the object is an edit control.
Let's get a pointer to the object.
CEdit* pedit = (CEdit*)GetDlgItem(IDC_EDIT1);
Now we have a pointer.
pEdit->
Look at all the vars the pointer has presented and scroll though the entire list until you see a "property" that defines the text color.
Please understand that this pointer is not the object, rather an instance of the object.
A house occupies space on a block.
The post office assigns an address to the the house.
Say 714 Houser Street.
The pointer contains the assigned address.
Now as for the commondialog to pick colors.
If I remeber right it is going to return a COLORREF.
So
COLORREF clr = dlgcolor.(Color value)
Not sure of structure as I use my own rather than common dlgs.
Good Luck
ez_way at 2007-11-11 0:45:21 >

# 3 Re: How to change the color of the text
Let say the object is an edit control.An edit control can't have different text colors per control - you'll need to use a RichEdit ctrl for that.
Let's get a pointer to the object.
CEdit* pedit = (CEdit*)GetDlgItem(IDC_EDIT1);
Now we have a pointer.
pEdit->
Look at all the vars the pointer has presented and scroll though the entire list until you see a "property" that defines the text color.
Please understand that this pointer is not the object, rather an instance of the object.
A house occupies space on a block.
The post office assigns an address to the the house.
Say 714 Houser Street.How is this related to the problem? Sounds more like a homework assignment...
# 4 Re: How to change the color of the text
Sorry just trying to help, didn;t mean to teach, I leeave it up to you pro's!
# 5 Re: How to change the color of the text
Just wanted to point out where the control is inherited from.
ez_way at 2007-11-11 0:48:16 >

# 6 Re: How to change the color of the text
If one uses a CRichText what property/method do you call to change the font color?
Sahir at 2007-11-11 0:49:26 >

# 7 Re: How to change the color of the text
If one uses a CRichText what property/method do you call to change the font color?
'CRichEditCtrl::SetSelectionCharFormat()'
'CRichEditCtrl::SetWordCharFormat()'