Solved

How to insert a thick Line into RichEditCtrl??

Posted on 2008-06-22
6
323 Views
Last Modified: 2013-11-20
Hi,

I am inserting a line into RichEditCtrl using AppendToLog() function(The defination of this function is attached as Code Snippet).......I am Calling this function as AppendToLog("______________________________________________________",RGB(24,233,170));
This call will insert a line into RichEditctrl(Which is not Thick),But i need this line to be inserted as a Very Thick Line..How can i solve this problem???
int CEncopyDlg::AppendToLog(CString str,COLORREF linecolor)

{

  int nOldLines = 0, nNewLines = 0, nScroll = 0;

  long nInsertionPoint = 0;

  CHARFORMAT cf;

  // Save number of lines before insertion of new text

  nOldLines = m_ctrlLog.GetLineCount();

  // Initialize character format structure

  cf.cbSize = sizeof(CHARFORMAT);

  cf.dwMask = CFM_COLOR;

  cf.dwEffects = 0; // To disable CFE_AUTOCOLOR

  cf.crTextColor = linecolor;

  // Set insertion point to end of text

  nInsertionPoint = m_ctrlLog.GetWindowTextLength();

  m_ctrlLog.SetSel(nInsertionPoint, -1);

  // Set the character format

  m_ctrlLog.SetSelectionCharFormat(cf);

  // Replace selection. Because we have nothing 

  // selected, this will simply insert

  // the string at the current caret position.

  m_ctrlLog.ReplaceSel(str);

  // Get new line count

  nNewLines = m_ctrlLog.GetLineCount();

  // Scroll by the number of lines just inserted

  nScroll = nNewLines - nOldLines;

  m_ctrlLog.LineScroll(nScroll);

  return 0;

}

Open in new window

0
Comment
Question by:Rajeshm8484
  • 4
  • 2
6 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 21841620
you have to insert a formatted paragraph with border like:

\par \brdrb\brdrs\brdrw50
0
 

Author Comment

by:Rajeshm8484
ID: 21841653
I did not understand,what ur trying to convey?So please explain briefly.
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 250 total points
ID: 21841743
it can be easier, the trick is the border. you don't have to add hyphens, just format a paragraph with a bottom border. It can be done by manipulating the PARAFORMAT2 structure, the following members:
    wBorderSpace
    wBorderWidth
    wBorders

More info at:
http://msdn.microsoft.com/en-us/library/bb787942(VS.85).aspx
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Rajeshm8484
ID: 21852653
Hi Jaime,

I have tried using PARAFORMAT2 structure for inserting a Thick line into Rich Edit Control......But i did not find any differences.

The code is :

  PARAFORMAT2 format;
  format.cbSize=sizeof(PARAFORMAT2);
  format.dwMask=PFM_BORDER;
  format.wBorderWidth=9000;
  format.wBorders=0x08 | 0x900 | 0x8000;
  m_ctrlLog.SetParaFormat(format);

0
 

Author Comment

by:Rajeshm8484
ID: 21862790
Hi,

PARAFORMAT2 structure with the above mentioned parameters is inserting a thick line into my RichRditControl.

ALso we can use CHARFORMAT2 structure in my Appendlog function(which is attached as code snippet) and change the parameters cf.dwMask = CFM_COLOR to cf.dwMask = CFM_COLOR|CFM_SIZE; and include cf.yheight=1000;
which also will insert a thick line ....

Thanks and Regards,
Rajesh.M
0
 

Author Closing Comment

by:Rajeshm8484
ID: 31469552
Thanks a lot jaime,it helped me a lot....Please try to give suggestions whenever i post a questions..
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
bigDiff challenge 17 83
FizzBuzz challenge 9 76
mapAB Challlenge 35 124
"Black Box" Testing of Control System Software 2 21
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now