set the paragraph at left,center,or right

General TRichView support forum. Please post your questions here
Post Reply
kkkdady
Posts: 11
Joined: Thu May 04, 2006 2:39 pm

set the paragraph at left,center,or right

Post by kkkdady »

I want to set the paragraph at left,center,or right.but it changed must after press a Keyword or the mouse press on it.Could you get me some advice. The codes are following:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(Sender == Button1)
RVStyle1->ParaStyles->Items[RichViewEdit1->CurParaStyleNo ]->Alignment = rvaLeft;
if(Sender == Button2)
RVStyle1->ParaStyles->Items[RichViewEdit1->CurParaStyleNo ]->Alignment = rvaCenter;
if(Sender == Button3)
RVStyle1->ParaStyles->Items[RichViewEdit1->CurParaStyleNo ]->Alignment = rvaRight;

}
Thank you!
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This code is not correct.
It changes properties of the current paragraph style. But this style may be used not only by the current paragraph, but by other paragraphs too.
And these changes become visible only after document reformatting.
And these changes cannot be undone/redone by user.

You should use ApplyParaStyleConversion method and OnParaStyleConversion event.
See the demo in
Demos\CBuilder\Editors\Editor 2\
kkkdady
Posts: 11
Joined: Thu May 04, 2006 2:39 pm

reply

Post by kkkdady »

Thank you! I have known how to use it!
Post Reply