开发者

Set font size of CLinkCtrl

Is it possible to set the font size of a CLinkCtrl? I tried the following code, but it does nothing!

EDIT: Oops, forgot to include my attempt:

CFont* aboutFont=nullptr;

BOOL AboutDlg::OnInitDialog(){
    SpecialDlg::OnInitDialog();
    if(aboutFont==nullptr){
        aboutFont=new CFont();
        aboutFont->CreateFont(
        20,                        // nHeight
        0,                         // nWidth
        0,                         // nEscapement
        0,                         // nOrientation
        FW_NORMAL,                 // nWeight
        FALSE,                     // bItalic
        FALSE,                     // bUnderline
        0,                     开发者_运维知识库    // cStrikeOut
        ANSI_CHARSET,              // nCharSet
        OUT_DEFAULT_PRECIS,        // nOutPrecision
        CLIP_DEFAULT_PRECIS,       // nClipPrecision
        DEFAULT_QUALITY,           // nQuality
        DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
        L"Arial");
    }
    ((CLinkCtrl*)GetDlgItem(ID_WEBSITE_LINK))->SetFont(aboutFont,true);
    return true;
}


I dont know what's wrong with your code or dialog resources. But I have tried setting the font of a CLinkCtrl (even without using variable or typecasting), and succeeded. I created font using CFont::CreatePointFont.

You first check the resource ID, also check if you create font with other approaches.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜