<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 10.7 自定義wxWidgets提供的小圖片 wxArtProvider這個類允許你更改wxWidgets默認提供的那些小圖片,比如wxWidgets HTML幫助閱讀器中或者默認的Log對話框中使用的圖片. wxWidgets提供了一個標準的wxArtProvider對象,并且體系內的一些需要使用圖標和小圖片的地方都調用了這個類的wxArtProvider::GetBitmap和wxArtProvider::GetIcon函數. 小圖片是由兩個標識符決定的:主標識符(wxArtID)和客戶區標識符(wxArtClient).其中客戶區標識符只在同一個主標識符在不同的窗口中需要不同的圖片的時候才使用,比如,wxHTML幫助窗口使用的圖標使用下面的代碼取得的: ``` wxBitmap bmp = wxArtProvider::GetBitmap(wxART_GO_BACK,wxART_TOOLBAR); ``` 如果你想瀏覽所有wxWidgets提供的小圖片以及它們的標識符,你可以編譯和運行wxWidgets自帶的samples/artprov中的例子,它的外觀如下圖所示: ![](img/mhtECAD%281%29.tmp) 要替換wxWidgets提供的這些小圖片,你需要實現一個wxArtProvider的派生類,重載其中的CreateBitmap函數,然后在 OnInit函數中調用wxArtProvider::PushProvider以便讓wxWidgets知道.下面的這個例子替換了wxHTML幫助窗口中的大部分默認的圖標: ``` // 新的圖標 #include "bitmaps/helpbook.xpm" #include "bitmaps/helppage.xpm" #include "bitmaps/helpback.xpm" #include "bitmaps/helpdown.xpm" #include "bitmaps/helpforward.xpm" #include "bitmaps/helpoptions.xpm" #include "bitmaps/helpsidepanel.xpm" #include "bitmaps/helpup.xpm" #include "bitmaps/helpuplevel.xpm" #include "bitmaps/helpicon.xpm" #include "wx/artprov.h" class MyArtProvider : public wxArtProvider { protected: virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size); }; // 新的CreateBitmap函數 wxBitmap MyArtProvider::CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size) { if (id == wxART_HELP_SIDE_PANEL) return wxBitmap(helpsidepanel_xpm); if (id == wxART_HELP_SETTINGS) return wxBitmap(helpoptions_xpm); if (id == wxART_HELP_BOOK) return wxBitmap(helpbook_xpm); if (id == wxART_HELP_FOLDER) return wxBitmap(helpbook_xpm); if (id == wxART_HELP_PAGE) return wxBitmap(helppage_xpm); if (id == wxART_GO_BACK) return wxBitmap(helpback_xpm); if (id == wxART_GO_FORWARD) return wxBitmap(helpforward_xpm); if (id == wxART_GO_UP) return wxBitmap(helpup_xpm); if (id == wxART_GO_DOWN) return wxBitmap(helpdown_xpm); if (id == wxART_GO_TO_PARENT) return wxBitmap(helpuplevel_xpm); if (id == wxART_FRAME_ICON) return wxBitmap(helpicon_xpm); if (id == wxART_HELP) return wxBitmap(helpicon_xpm); // Any wxWidgets icons not implemented here // will be provided by the default art provider. return wxNullBitmap; } // 你的初始化函數 bool MyApp::OnInit() { ... wxArtProvider::PushProvider(new MyArtProvider); ... return true; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看