달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
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; 
}


:
Posted by 해타리