缩减标签显示在c ++ mfc应用程序中

时间:2016-10-14 08:29:11

标签: c++ mfc

我开发了一些C ++ MFC应用程序。在我的对话框中有一个进度条和一个带有常量文本的标签(西里尔符号)。

在Windows 7,XP上,此文本显示效果不错,但在Windows 8,10上显示为缩小格式。

为什么?

这是在Windows 7上:

enter image description here

这是在Windows 8上:

enter image description here

这是与此对话框表格相关的类的源代码。 * .cpp文件:

entryComponents

和* .h文件:

// Progress.cpp : implementation file
//

#include "stdafx.h"
#include "LybidLoader.h"
#include "Progress.h"
#include "afxdialogex.h"


// Progress dialog

IMPLEMENT_DYNAMIC(Progress, CDialogEx)

Progress::Progress(CWnd* pParent /*=NULL*/)
: CDialogEx(Progress::IDD, pParent)
{

}

Progress::~Progress()
{
}

void Progress::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_PROGRESS1, m_ProgressBar);
}


BEGIN_MESSAGE_MAP(Progress, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON1, &Progress::OnBnClickedForceExit)
END_MESSAGE_MAP()


// Progress message handlers


BOOL Progress::OnInitDialog()
{
    CDialogEx::OnInitDialog();

    ModifyStyle( WS_SYSMENU, 0);

    m_ProgressBar.SetMarquee(TRUE, 10);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}


void Progress::OnBnClickedForceExit()
{   
    if (::MessageBoxW(this->m_hWnd, (LPCWSTR)_T("Ви впевнені? Буде здійснено        аварійний вихід"), (LPCWSTR)_T("Підтвердіть дію"), MB_ICONEXCLAMATION |         MB_YESNO) == IDYES)
    {
        PostQuitMessage(0);
    }           
}


BOOL Progress::PreTranslateMessage(MSG* pMsg)
{
    // TODO: Add your specialized code here and/or call the base class

    if( pMsg->message == WM_KEYDOWN )
    {
        if(pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)
        {
            return TRUE;                // Do not process further
        }
    }

    return CDialogEx::PreTranslateMessage(pMsg);
}

这是资源文件的一部分:

#pragma once
#include "afxcmn.h"


// Progress dialog

class Progress : public CDialogEx
{
    DECLARE_DYNAMIC(Progress)

public:
    Progress(CWnd* pParent = NULL);   // standard constructor
    virtual ~Progress();

// Dialog Data
    enum { IDD = IDD_PROGRESSBAR };

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

    DECLARE_MESSAGE_MAP()
public:
    virtual BOOL OnInitDialog();
    CProgressCtrl m_ProgressBar;



    afx_msg void OnBnClickedForceExit();
    virtual BOOL PreTranslateMessage(MSG* pMsg);
};

2 个答案:

答案 0 :(得分:4)

忽略以下图片中的垃圾字符,这只是一个代码页问题。

您为静态文本控件提供的空间太小:

第一个对话框是你的,修改它看起来像第二个。

enter image description here

答案 1 :(得分:1)

它可以是字体DPI,也可以是字体本身。它可能是" Microsoft Sans Serif"映射到不同的字体。我已经完成了足够的本地化工作,知道某些字体并非在所有系统上都可用。我认为" Microsoft Sans Serif"可能会,但我已经看到远东地区的系统" Arial"不在系统上。

如果我是你,我会改变" Microsoft Sans Serif"到" MS Shell Dlg"在对话框资源中。 " MS Shell Dlg"是一种虚拟字体,大致映射到默认的GUI字体。