Search

'CEdit'에 해당되는 글 2건

  1. 2016.10.25 CEdit control의 font 바꾸기
  2. 2016.10.20 MFC CWnd Control Border Color Change

CEdit control의 font 바꾸기

Programming/MFC 2016. 10. 25. 13:52 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

CEdit control의 font 바꾸기


요약
Windows 95 에서 Edit control를 사용할 때는 일반적으로 font를 바꾸지 않고 그대로 사용한다. 그러나 MFC에서는 CEdit control를 사용하는 경우 CWnd::SetFont()를 이용해서 그 font를 바꿀수가 있다. 

한글 Windows 95를 사용할 때는 CWnd::SetFont()에서 사용하게 될 LOGFONT의 lfCharSet 변수를 한글 Character Set code인 0x81 로 setting해 주어야 한다.
추가 정보
다음은 Dialog의 edit control의 font를 20 point의 궁서체로 바꾸는 예이다.
BOOL CMyDlg::OnInitDialog() 
{
LOGFONT lf;

memset(&lf, 0, sizeof(LOGFONT));
lf.lfCharSet = 0x81;			// 한글 Character Set
lf.lfHeight = 20;			// 20 point 크기
strcpy(lf.lfFaceName, "궁서체"); 	// 궁서체로 font setting
m_font.CreateFontIndirect(&lf);	

CEdit* pCtlEdit = (CEdit*) GetDlgItem(IDC_EDIT1); // edit control의 
                                                  // pointer를 가져옴
pCtlEdit->SetFont((CFont*)&m_font, TRUE);

return TRUE;
}
					


출처 : https://support.microsoft.com/ko-kr/kb/600665





추가로 CFont m_font; 선언 필요.





MFC CWnd Control Border Color Change

Programming/MFC 2016. 10. 20. 14:48 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

MFC CWnd Control Border Color Change









CWnd::OnNcPaint

 

게시: 2016년 4월

The framework calls this member function when the nonclient area needs to be painted.

비클라이언트 영역을 그려야 할 때 프레임 워크는이 멤버 함수를 호출 합니다.

afx_msg void OnNcPaint( );

The default implementation paints the window frame.


An application can override this call and paint its own custom window frame. The clipping region is always rectangular, even if the shape of the frame is altered.


기본 구현에서는 창 프레임을 그립니다.


응용 프로그램이이 호출을 무시 하 고 자체 사용자 지정 창 프레임을 페인트할 수 있습니다. 클리핑 영역은 프레임의 모양을 변경 하는 경우에 항상 사각형입니다.



void CDerivedEdit::OnNcPaint() 
{
		CDC* pDC = GetWindowDC( );
		
		//work out the coordinates of the window rectangle,
		CRect rect;
		GetWindowRect( &rect);
		rect.OffsetRect( -rect.left, -rect.top);
		
		//Draw a single line around the outside
		CBrush brush( RGB( 255, 0, 0));
		pDC->FrameRect( &rect, &brush);
		ReleaseDC( pDC);
}


'Programming > MFC' 카테고리의 다른 글

CEdit control의 font 바꾸기  (0) 2016.10.25
CTextProgressCtrl hide Edge  (0) 2016.10.25
MFC CheckBox 컨트롤의 현재 상태  (0) 2016.10.19
MFC Control Color Change  (0) 2016.10.19
MFC Bitmap Button  (0) 2016.10.18