Unicode字符到CEdit

Unicode character into CEdit

我正在生成自定义 CEdit 控件,允许我在其上设置一些不同的颜色。在我使用 ES_PASSWORD.

样式生成控件之前,它工作正常

在这些情况下,我找不到写我想要的字符(大黑点)的方法。以下是我试过的一些代码:

第一个选项:

int lenght = text.GetLength();
text = "";
for (int i = 0; i < lenght; i++) text.AppendChar('\u25CF');

第二个选项:

int lenght = text.GetLength();
text = "";
for (int i = 0; i < lenght; i++) text.Append("\u25CF");

第三个选项:

int lenght = text.GetLength();
text = "";
for (int i = 0; i < lenght; i++) text.AppendChar((char)"\u25CF");

我不明白为什么控件没有显示正确的字符。它只显示:<。我究竟做错了什么?

更新

这是我正在使用的 OnPaint() 方法:

void CEasyEdit::OnPaint()
{
    // I generate all requiered objects.
    CPaintDC dc(this);
    CRect ClientRect;
    GetClientRect(&ClientRect);

    // I define which colors I want to use.
    SetDefaultColors();

    // I paint the background and its borders.
    CBrush brush(m_clrBack);
    dc.FillRect(ClientRect, &brush);
    CRect border_rect;
    this->GetClientRect(border_rect);
    border_rect.InflateRect(1, 1);
    dc.Draw3dRect(border_rect, m_clrBack, m_clrBack);
    border_rect.InflateRect(1, 1);
    dc.Draw3dRect(border_rect, m_clrBack, m_clrBack);

    // I redefine the size of the rect.
    CRect textRect(ClientRect);
    textRect.DeflateRect(4, 1);

    // I define the text to draw.
    CString text;
    GetWindowText(text);

    // If it displays a password, I change its characters.
    if (GetStyle() & ES_PASSWORD)
    {
        // I redefine the text to show.
        int lenght = text.GetLength();
        wchar_t f = '1060';
        text = "";
        for (int i = 0; i < lenght; i++) text.Append("\u0053");
    }

    // I draw the text.
    dc.SetTextColor(m_clrText);
    dc.SetBkColor(m_clrBack);   
    dc.SelectObject(GetFont());
    dc.DrawText(text, -1, textRect, GetStyle());
}

我正在查找 CEdit::GetPasswordChar,我注意到上面写着:

If you create the edit control with the ES_PASSWORD style, the DLL that supports the control determines the default password character. The manifest or the InitCommonControlsEx method determines which DLL supports the edit control. If user32.dll supports the edit control, the default password character is ASTERISK ('*', U+002A). If comctl32.dll version 6 supports the edit control, the default character is BLACK CIRCLE ('●', U+25CF). For more information about which DLL and version supports the common controls, see Shell and Common Controls Versions.

就是说,为什么你不能只使用 CEdit::SetPasswordChar 它指出的地方:

Specifies the character to be displayed in place of the character typed by the user. If ch is 0, the actual characters typed by the user are displayed.