Esempio n. 1
0
void CSListView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	//	SetColumn
	ResetColumns( );

	// Create Tab
	if( !::IsWindow( m_wndWorkTab.GetSafeHwnd() )
		&& m_wndWorkTab.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this, IDC_SLISTVIEW_WORKTAB) )
	{
		CString	strName;
		strName.LoadString( IDS_SLISTVIEW_CLASS );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_CLASS);
		strName.LoadString(IDS_SLISTVIEW_NQ);
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_NQ);
		strName.LoadString( IDS_SLISTVIEW_A );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_A);
		strName.LoadString( IDS_SLISTVIEW_SZNB );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_SZNB);
		strName.LoadString( IDS_SLISTVIEW_SHB );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_SHB);
		strName.LoadString( IDS_SLISTVIEW_BOND );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_BOND);
		strName.LoadString( IDS_SLISTVIEW_FUND );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_FUND);
		strName.LoadString( IDS_SLISTVIEW_SELF );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_SELF);
		strName.LoadString( IDS_SLISTVIEW_GROUP );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_GROUP);
		strName.LoadString( IDS_SLISTVIEW_DOMAIN );
		m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_DOMAIN);

		m_wndWorkTab.SetSelectTabColor( AfxGetProfile().GetColor(CColorClass::clrSListBK),
										AfxGetProfile().GetColor(CColorClass::clrTitle) );
		m_wndWorkTab.SetActualTitle(FALSE);
		m_wndWorkTab.SetCurtab( SL_WORKTAB_SELF );

		CFont font;
		font.CreateStockObject (DEFAULT_GUI_FONT);
		m_wndWorkTab.SetFont( &font );

		// m_Grid No HScrollBar
		m_Grid.SetOuterHScrollBar( TRUE, m_wndWorkTab.GetSafeHwnd() );
	}
}
Esempio n. 2
0
void CIVInfoLabel::DrawLabel(CDC & dcTarget)
{
	CRect rc;
	GetClientRect (&rc);

	CDC dc;	
	dc.CreateCompatibleDC (&dcTarget);

	CBitmap bmp;
	bmp.CreateCompatibleBitmap (&dcTarget, rc.Width(), rc.Height());
	
	dc.SelectObject (&bmp);
	
	CBrush brush;
	brush.CreateSysColorBrush (COLOR_3DFACE);

	dc.SelectObject (&brush);
	dc.PatBlt (0,0, rc.Width(), rc.Height(), PATCOPY);
	

	CFont font;
	font.CreateStockObject (DEFAULT_GUI_FONT);
	dc.SelectObject (&font);

	dc.SetBkColor ( GetSysColor (COLOR_3DFACE));
	dc.SetTextColor ( GetSysColor (COLOR_WINDOWTEXT));

	CRect rcCalc = rc;
	
	LPTSTR szStr =  (LPTSTR) (LPCTSTR) m_strText;

	DrawTextEx (dc, szStr, -1, &rcCalc,  DT_CALCRECT | DT_CENTER | DT_WORDBREAK, NULL);
	
	int nOffset = rcCalc.Height() < rc.Height() 
		? ( rc.Height() - rcCalc.Height() ) / 2 : 0;

	rcCalc = rc;
	rcCalc.top += nOffset;

	DrawTextEx (dc, szStr, -1, &rcCalc,  DT_CENTER | DT_WORDBREAK, NULL);
	
	dcTarget.BitBlt(rc.left,rc.top,rc.Width(),rc.Height(),&dc,0,0,SRCCOPY);
}
int CMusikSourcesCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if ( CMusikPropTree::OnCreate(lpCreateStruct) == -1 )
        return -1;

    if ( m_DropTarget )
        m_DropTarget->Register( this );


    // edit in place
    m_EditInPlace.Create( WS_CHILD, CRect( 0, 0, 0, 0 ), this, 123 );

    CFont font;
    font.CreateStockObject( DEFAULT_GUI_FONT );
    m_EditInPlace.SetFont( &font );

    InitItems();

    return 0;
}
Esempio n. 4
0
BOOL CLoungeDlg::OnInitDialog()
{
  VERIFY(radioBtnOn_.LoadBitmap(IDB_RADIO_ON, IDB_RADIOMASK));
  VERIFY(radioBtnOff_.LoadBitmap(IDB_RADIO_OFF, IDB_RADIOMASK));

  CDialog::OnInitDialog();

  CFont f;
  f.CreateStockObject(DEFAULT_GUI_FONT);
  LOGFONT lf;
  f.GetLogFont(&lf);
  if (lf.lfHeight > 0)
      lf.lfHeight += 2;
  else
      lf.lfHeight -= 2;
  font_.CreateFontIndirect(&lf);
  GetDlgItem(IDC_LD_RADIO1)->SetFont(&font_);
  GetDlgItem(IDC_LD_RADIO2)->SetFont(&font_);

  CDC dc;
  dc.CreateCompatibleDC(NULL);
  CRect r;
  GetDlgItem(IDC_LD_RADIO1)->GetWindowRect(&r);
  ScreenToClient(&r);
  rectRadio1_ = r;
  CFont* pOldFont = dc.SelectObject(&font_);

  Base::DrawBumpText(&dc, g_szViewByWaitingLists,
                     rectRadio1_, DT_CALCRECT,
                     0, 0);
  rectRadio1_.right += 16;
  radioYOffset_ = rectRadio1_.Height() - r.Height();

  GetDlgItem(IDC_LD_RADIO2)->GetWindowRect(&r);
  ScreenToClient(&r);
  rectRadio2_ = r;
  Base::DrawBumpText(&dc, g_szViewByTables,
                     rectRadio2_, DT_CALCRECT,
                     0, 0);
  rectRadio2_.right += 16;
  dc.SelectObject(pOldFont);

  GetDlgItem(IDC_LD_RADIO1)->GetWindowRect(&r);
  ScreenToClient(&r);

  GetDlgItem(IDC_LD_RADIO2)->GetWindowRect(&r);
  ScreenToClient(&r);

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);			// Set big icon
  SetIcon(m_hIcon, FALSE);		// Set small icon
	
  addInitialData();

  pDetailsDlg_ = new CTableDetailsDlg(this);
  if (pDetailsDlg_)
    if (!pDetailsDlg_->Create(IDD_TABLEDETAILS, this))
    {
      TRACE0("Failed to create table details window\n");
    }

  pTournamentDlg_ = new CTournamentDetailsDlg(this);
  if (pTournamentDlg_)
    if (!pTournamentDlg_->Create(IDD_TOURNAMENTDETAILS, this))
    {
      TRACE0("Failed to create tourmanet details window\n");
    }

  pChatDlg_ = new CChatDlg(this);
  if (pChatDlg_)
    if (!pChatDlg_->Create(NULL, NULL, WS_CHILD|WS_VISIBLE, CFrameWnd::rectDefault, this, IDD_CHAT))
    {
      TRACE0("Failed to create chat window\n");
    }

  restoreSettings();

  // Begin with the splash screen
  PostMessage(WM_COMMAND,
              MAKEWPARAM(ID_SHOW_SPLASH,0), 0);

  //setBannerText("Testing Testing 1 2 3...", 0);

  return TRUE;  // return TRUE  unless you set the focus to a control
}
Esempio n. 5
0
void AFX_GLOBAL_DATA::UpdateFonts()
{
	CWindowDC dc(NULL);
	m_dblRibbonImageScale = dc.GetDeviceCaps(LOGPIXELSX) / 96.0f;

	if (m_dblRibbonImageScale > 1. && m_dblRibbonImageScale < 1.1)
	{
		m_dblRibbonImageScale = 1.;
	}

	if (fontRegular.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontRegular.Detach());
	}

	if (fontTooltip.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontTooltip.Detach());
	}

	if (fontBold.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontBold.Detach());
	}

	if (fontDefaultGUIBold.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontDefaultGUIBold.Detach());
	}

	if (fontUnderline.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontUnderline.Detach());
	}

	if (fontDefaultGUIUnderline.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontDefaultGUIUnderline.Detach());
	}

	if (fontVert.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontVert.Detach());
	}

	if (fontVertCaption.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontVertCaption.Detach());
	}

	if (fontMarlett.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontMarlett.Detach());
	}

	if (fontSmall.GetSafeHandle() != NULL)
	{
		::DeleteObject(fontSmall.Detach());
	}

	// Initialize fonts:

	NONCLIENTMETRICS info;
	info.cbSize = sizeof(info);
	GetNonClientMetrics (info);

	LOGFONT lf;
	memset(&lf, 0, sizeof(LOGFONT));

	lf.lfCharSet = (BYTE) GetTextCharsetInfo(dc.GetSafeHdc(), NULL, 0);

	lf.lfHeight = info.lfMenuFont.lfHeight;
	lf.lfWeight = info.lfMenuFont.lfWeight;
	lf.lfItalic = info.lfMenuFont.lfItalic;

	//------------------
	// Adjust font size:
	//------------------
	int nFontHeight = lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight;
	if (nFontHeight <= 12)
	{
		nFontHeight = 11;
	}
	else if (!m_bDontReduceFontHeight)
	{
		nFontHeight--;
	}

	lf.lfHeight = (lf.lfHeight < 0) ? -nFontHeight : nFontHeight;

	// Check if we should use system font
	lstrcpy(lf.lfFaceName, info.lfMenuFont.lfFaceName);

	BOOL fUseSystemFont = m_bUseSystemFont || (info.lfMenuFont.lfCharSet > SYMBOL_CHARSET);
	if (!fUseSystemFont)
	{
		// Check for "Segoe UI" or "Tahoma" font existance:
		if (::EnumFontFamilies(dc.GetSafeHdc(), NULL, FontFamilyProcFonts, (LPARAM)(LPCTSTR) AFX_FONT_NAME_OFFICE_2007) == 0)
		{
			// Found! Use MS Office 2007 font!
			lstrcpy(lf.lfFaceName, AFX_FONT_NAME_OFFICE_2007);
			lf.lfQuality = 5 /*CLEARTYPE_QUALITY*/;
		}
		else if (::EnumFontFamilies(dc.GetSafeHdc(), NULL, FontFamilyProcFonts, (LPARAM)(LPCTSTR) AFX_FONT_NAME_OFFICE) == 0)
		{
			// Found! Use MS Office font!
			lstrcpy(lf.lfFaceName, AFX_FONT_NAME_OFFICE);
		}
		else
		{
			// Not found. Use default font:
			lstrcpy(lf.lfFaceName, AFX_FONT_NAME_DEFAULT);
		}
	}
	
	fontRegular.CreateFontIndirect(&lf);

	// Create small font:
	LONG lfHeightSaved = lf.lfHeight;

	lf.lfHeight = (long)((1. + abs(lf.lfHeight)) * 2 / 3);
	if (lfHeightSaved < 0)
	{
		lf.lfHeight = -lf.lfHeight;
	}

	fontSmall.CreateFontIndirect(&lf);
	lf.lfHeight = lfHeightSaved;

	// Create tooltip font:
	NONCLIENTMETRICS ncm;
	ncm.cbSize = sizeof(ncm);
	GetNonClientMetrics (ncm);

	lf.lfItalic = ncm.lfStatusFont.lfItalic;
	lf.lfWeight = ncm.lfStatusFont.lfWeight;
	fontTooltip.CreateFontIndirect(&lf);

	lf.lfItalic = info.lfMenuFont.lfItalic;
	lf.lfWeight = info.lfMenuFont.lfWeight;

	// Create "underline" font:
	lf.lfUnderline = TRUE;
	fontUnderline.CreateFontIndirect(&lf);
	lf.lfUnderline = FALSE;

	// Create bold font:
	lf.lfWeight = FW_BOLD;
	fontBold.CreateFontIndirect(&lf);

	// Create Marlett font:
	BYTE bCharSet = lf.lfCharSet;
	lf.lfWeight = info.lfMenuFont.lfWeight;
	lf.lfCharSet = SYMBOL_CHARSET;
	lf.lfWeight = 0;
	lf.lfHeight = ::GetSystemMetrics(SM_CYMENUCHECK) - 1;
	lstrcpy(lf.lfFaceName, AFX_FONT_NAME_MARLETT);

	fontMarlett.CreateFontIndirect(&lf);
	lf.lfCharSet = bCharSet; // Restore charset

	// Create vertical font:
	CFont font;
	if (font.CreateStockObject(DEFAULT_GUI_FONT))
	{
		if (font.GetLogFont(&lf) != 0)
		{
			lf.lfOrientation = 900;
			lf.lfEscapement = 2700;

			lf.lfHeight = info.lfMenuFont.lfHeight;
			lf.lfWeight = info.lfMenuFont.lfWeight;
			lf.lfItalic = info.lfMenuFont.lfItalic;

			{
				lstrcpy(lf.lfFaceName, AFX_FONT_NAME_VERT);
			}

			fontVert.CreateFontIndirect(&lf);

			lf.lfEscapement = 900;
			fontVertCaption.CreateFontIndirect(&lf);
		}
	}

	// Create dialog underline and bold fonts:
	CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
	ASSERT_VALID(pDefaultGUIFont);
	pDefaultGUIFont->GetLogFont(&lf);

	lf.lfUnderline = TRUE;
	fontDefaultGUIUnderline.CreateFontIndirect(&lf);
	lf.lfUnderline = FALSE;

	lf.lfWeight = FW_BOLD;
	fontDefaultGUIBold.CreateFontIndirect(&lf);

	UpdateTextMetrics();

#if 0
	// Notify toolbars about font changing:
	for (POSITION posTlb = afxAllToolBars.GetHeadPosition(); posTlb != NULL;)
	{
		CMFCToolBar* pToolBar = (CMFCToolBar*) afxAllToolBars.GetNext(posTlb);
		ENSURE(pToolBar != NULL);

		if (CWnd::FromHandlePermanent(pToolBar->m_hWnd) != NULL)
		{
			ASSERT_VALID(pToolBar);
			pToolBar->OnGlobalFontsChanged();
		}
	}
#endif
}