-
June 9th, 2011, 12:03 AM
#1
CRichEditCtrl SetSelectionCharFormat setting very big height issue
Hi;
i am using CRichEditCtrl in my application.
Question:-
----------------------------------------------------------------
I need to set the height of the Selection using the method SetSelectionCharFormat.
if height is too much then its not set properly ?
But the CHARFORMAT structure taking yHeight as LONG , then why we can't set th LONG height ?
Example and code snippet:-
----------------------------------------------------------------
here below line of code for better understanding:---
CHARFORMAT cf;
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_SIZE;
cf.yHeight = 634776; //-----> if height is too much
SetSelectionCharFormat(cf);
DWORD dwSelMask = GetSelectionCharFormat(cf); //--> here cf.yHeight comes out as 32767
Thnx
-
June 9th, 2011, 02:18 AM
#2
Re: CRichEditCtrl SetSelectionCharFormat setting very big height issue
It's just a guess, but rich edit control evolved from an older 16-bit version, so it may be quite possible that it still uses a 16-bit variable to computer that parameter (32767 is the largest possible value for a signed 16-bit variable. Example: short type.)
-
June 9th, 2011, 02:57 AM
#3
Re: CRichEditCtrl SetSelectionCharFormat setting very big height issue
Originally Posted by ahmd
It's just a guess, but rich edit control evolved from an older 16-bit version, so it may be quite possible that it still uses a 16-bit variable to computer that parameter (32767 is the largest possible value for a signed 16-bit variable. Example: short type.)
thnx for the reply.
yes that's the reason.
But how can i set the LONG value in the height ? any alternative ? I have used CHARFORMAT2 structure also , but no success.
-
June 9th, 2011, 03:04 AM
#4
Re: CRichEditCtrl SetSelectionCharFormat setting very big height issue
Originally Posted by asim2011
But how can i set the LONG value in the height ? any alternative ?
I don't think rich edit can handle it. Let me ask, why do you need to set it so high?
-
June 9th, 2011, 03:47 AM
#5
Re: CRichEditCtrl SetSelectionCharFormat setting very big height issue
Originally Posted by ahmd
I don't think rich edit can handle it. Let me ask, why do you need to set it so high?
My application having the TextEditor (which is CRichEditCtrl) , in which user can select text and update its Height/Color/Bold/Italic/Font Attributes.
Default TextSize is 0.2 , which i have converted in twips and create the text.
Suppose user write the text "abc" , now he selects "all text" with CTRL+A . then he make the size in the edit control as (1000) .Then on conversion to twips , it becomes too much size , and SetSelectionCharFormat get failed.
*i have seen that problem also occuring in the Windows 'Wordpad.exe"
thnx
-
June 9th, 2011, 04:04 AM
#6
Re: CRichEditCtrl SetSelectionCharFormat setting very big height issue
As I posted in one other thread, a rich edit control is hardly used for anything other than a simple output of a long (unformatted) text. Even Microsoft themselves don't use it too much. (The only place I see it used now is mostly to display EULA scripts.) As you might have also noticed the Wordpad is not that popular either.
From my personal experience, the rich edit control has very many bugs. Besides that it becomes very slow when handling larger files with more formatting if you implement it using available documentation. Also unfortunately most of rich edit functionality is poorly documented as well.
So my suggestion to you is either write your own control from scratch (quite a time consuming process) or buy an already prepared GUI control. Search the web for Windows GUI controls. Also take a peek at already written (free) text editors at the main page of Codeguru.com and codeproject.com as well.
-
June 9th, 2011, 04:32 AM
#7
Re: CRichEditCtrl SetSelectionCharFormat setting very big height issue
Thnx for the support , let me try by codeproject sample.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|