2015. 11. 11. 12:18
TRichEdit 특정 위치 의 배경색 Get / Set 작업2015. 11. 11. 12:18
void TmainForm::SetBackColor(int SelStart, int SelLength, TColor color)
{
//BackColor 설정
Richedit::CHARFORMAT2 cf;
RichEdit1->SelStart = SelStart;
RichEdit1->SelLength = SelLength;
RichEdit1->Lines->BeginUpdate();
memset(&cf,0,sizeof(Richedit::CHARFORMAT2));
cf.cbSize=sizeof(Richedit::CHARFORMAT2);
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = color;
SendMessage(RichEdit1->Handle,EM_SETCHARFORMAT,SCF_SELECTION,(LPARAM)&cf);
RichEdit1->Lines->EndUpdate();
}
TColor TmainForm::GetBackColor(int SelStart, int SelLength)
{
Richedit::CHARFORMAT2 cf;
RichEdit1->SelStart = SelStart;
RichEdit1->SelLength = SelLength;
memset(&cf,0,sizeof(Richedit::CHARFORMAT2));
cf.cbSize=sizeof(Richedit::CHARFORMAT2);
cf.dwMask = CFM_BACKCOLOR;
SendMessage(RichEdit1->Handle,EM_GETCHARFORMAT,SCF_SELECTION,(LPARAM)&cf);
return cf.crBackColor;
}
{
//BackColor 설정
Richedit::CHARFORMAT2 cf;
RichEdit1->SelStart = SelStart;
RichEdit1->SelLength = SelLength;
RichEdit1->Lines->BeginUpdate();
memset(&cf,0,sizeof(Richedit::CHARFORMAT2));
cf.cbSize=sizeof(Richedit::CHARFORMAT2);
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = color;
SendMessage(RichEdit1->Handle,EM_SETCHARFORMAT,SCF_SELECTION,(LPARAM)&cf);
RichEdit1->Lines->EndUpdate();
}
TColor TmainForm::GetBackColor(int SelStart, int SelLength)
{
Richedit::CHARFORMAT2 cf;
RichEdit1->SelStart = SelStart;
RichEdit1->SelLength = SelLength;
memset(&cf,0,sizeof(Richedit::CHARFORMAT2));
cf.cbSize=sizeof(Richedit::CHARFORMAT2);
cf.dwMask = CFM_BACKCOLOR;
SendMessage(RichEdit1->Handle,EM_GETCHARFORMAT,SCF_SELECTION,(LPARAM)&cf);
return cf.crBackColor;
}