如题,最近使用MS Chart控件,里面的字太大,想自己定制字体.不过,不会用COleFont,查了CSDN和MSDN,都没有.晕大了.100分求助,呵呵,已经没有多少分了~~~~

解决方案 »

  1.   

    COleFont类 就这么几个成员函数:class COleFont : public COleDispatchDriver
    {
    public:
    COleFont() {} // Calls COleDispatchDriver default constructor
    COleFont(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
    COleFont(const COleFont& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}// Attributes
    public:
    CString GetName();
    void SetName(LPCTSTR);
    CY GetSize();
    void SetSize(const CY&);
    BOOL GetBold();
    void SetBold(BOOL);
    BOOL GetItalic();
    void SetItalic(BOOL);
    BOOL GetUnderline();
    void SetUnderline(BOOL);
    BOOL GetStrikethrough();
    void SetStrikethrough(BOOL);
    short GetWeight();
    void SetWeight(short);
    short GetCharset();
    void SetCharset(short);// Operations
    public:
    };
    它的函数都很简单,例如://Setup Local Variables in your code
    COleFont MyFont;
    CY FontSize;//Get a copy of the font from the component
    MyFont = m_chart.GetFont();//Set the Font Size
    FontSize.int64 = 240000; //Point Size 24 (24 * 10000 = 240000)
    MyFont.SetSize(FontSize);//Set the Font Name
    MyFont.SetName("Times New Roman");  //"Arial"等等//Set Various Font Styles
    MyFont.SetBold(TRUE);
    MyFont.SetItalic(FALSE); 
    MyFont.SetUnderline(FALSE);
    MyFont.SetStrikethrough(FALSE);//Set the font back on the component
    m_chart.SetFont(MyFont);