|
혼자 질문 올려놓고 답하니 뻘쭘하네요;;;
richMsg->Text = richMsg->Text + "Test"; 이 부분을
richMsg->SelText = "Test"; 이렇게 수정하니까 색깔 먹으면서 변형 가능하네요.
시녕tm 님이 쓰신 글 :
: TRichEdit 에서 한줄에 중간중간 색상을 다르게 표기할수 있는 건가요?
: 제가 알기론 한줄에 한색상으로만 표기되는 것으로 압니다.
:
: richMsg->Text = richMsg->Text + "Test";
: 이 부분을
: richMsg->Lines->Add("Test");
: 로 변경하시면 색상이 줄단위로 변경되는 것을 확인할수 있습니다.
:
: 한 줄에 중간 중간 문자의 색상을 변경할 수 있는 쉬운 방법이 있는지 저도 알고싶네요...
:
:
:
: 이영섭 님이 쓰신 글 :
: : 문자를 입력받아서 중간중간 색상을 변형하려고하는데 잘 안되네요. 아래는 제가 사용한 코드구요.
: :
: :
: : void __fastcall TForm1::TeButton1Click(TObject *Sender)
: : {
: : static int a = 0;
: : a++;
: : if(a%3 == 0)
: : richMsg->SelAttributes->Color = clYellow;
: : else if ( a%3 ==1)
: : richMsg->SelAttributes->Color = clRed;
: : else
: : richMsg->SelAttributes->Color = clLime;
: : richMsg->Text = richMsg->Text + "Test";
: : }
: : //---------------------------------------------------------------------------
: :
: : void __fastcall TForm1::btnMsgParagraphYellowClick(TObject *Sender)
: : {
: : richMsg->SelAttributes->Color = clYellow;
: : }
: : //---------------------------------------------------------------------------
: : void __fastcall TForm1::btnMsgParagraphGreenClick(TObject *Sender)
: : {
: : richMsg->SelAttributes->Color = clLime;
: : }
: : //---------------------------------------------------------------------------
: : void __fastcall TForm1::btnMsgParagraphRedClick(TObject *Sender)
: : {
: : richMsg->SelAttributes->Color = clRed;
: : }
: : //---------------------------------------------------------------------------
: :
: : 버튼을 누르면 번갈아가면서 붉은색, 노랑, 라임 색이 나와야하는데 무조건 노랑으로 도배되더라구요.
: : richMsg->SelAttributes->Color = clRed; 이 문구를 실행하고 입력하면 색상이 변하는데, 함수 안에서
: : if(a%3 == 0)
: : richMsg->SelAttributes->Color = clYellow; 이런식으로 사용했더니 무조건 노랑으로만 나오는데, 따로 뭐 설정해야하는게 있으면 좀 알려주세요.
|