본문 바로가기
C#/컨트롤

(static) 컨트롤 배경 바꾸기

by izen8 2018. 1. 22.
반응형



Control 배경은 WM_CTRLCOLOR 메세지에서 처리 할 수 있다. 

하지만 static컨트롤의 배경색 및 글자색 및 크기를 동적으로 바꿔야 한다면, 

사용법은 static컨트롤을 컨트롤변수로 지정한 뒤, 이를 CLabel로 바꾸어 주면 된다.
  -CStatic m_cLabel -> CLabel m_cLabel

주요 함수는 다음과 같다.

  - 배경색 및 글자색과 같은 스타일 변경
    CLabel& SetBkColor(COLORREF crBkgnd); 
    CLabel& SetTextColor(COLORREF crText);
    CLabel& SetText(const CString& strText);
    CLabel& SetFontBold(BOOL bBold);
    CLabel& SetFontName(const CString& strFont);
    CLabel& SetFontUnderline(BOOL bSet);
    CLabel& SetFontItalic(BOOL bSet);    
    CLabel& SetFontSize(int nSize);
    CLabel& SetSunken(BOOL bSet);
    CLabel& SetBorder(BOOL bSet);

  - Static컨트롤에서 깜박이는 효과를 연출한다.
    CLabel& FlashText(BOOL bActivate);
    CLabel& FlashBackground(BOOL bActivate);



반응형

댓글