English 中文(简体)
无法获得适用于wxWidgets工具栏的正确的Vista / 7主题
原标题:Cannot get a proper Vista / 7 theme for toolbar with wxWidgets

我无法使用wxWidgets(c ++)获取Vista / 7中工具栏的适当主题。出于某种未知的原因,现在我得到灰色的条(如您在这里所看到的)。我想要它看起来更像这个。我已链接到comctl32.lib(=> 5.82),并且UXTHEME也在使用。这里是代码:


#include <wx/wx.h>

class TestAppFrame: public wxFrame
{
        public:
                TestAppFrame(wxWindow *parent,
                             wxWindowID id = wxID_ANY,
                             const wxString &title = wxT("Test"),
                             const wxPoint &position = wxDefaultPosition,
                             const wxSize &size = wxSize(373, 206),
                             long style = wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL)
                : wxFrame(parent, id, title, position, size, style)
                {
                        wxToolBar *tb = CreateToolBar(wxNO_BORDER | wxHORIZONTAL | wxTB_FLAT);

                        tb->Realize();

                        SetToolBar(tb);
                }
};

class TestApp: public wxApp
{
        public:
                bool OnInit()
                {
                        if (!wxApp::OnInit())
                                return false;

                        wxInitAllImageHandlers();

                        TestAppFrame *frame = new TestAppFrame(NULL);

                        frame->Show(true);

                        return true;
                }
};

IMPLEMENT_APP(TestApp)

我在这里做错了什么?

Best regards,
nhaa123

最佳回答

渐变钢筋样式的背景对于 Vista/7 下的工具栏实际上是不合适的,如果您查看任何使用工具栏而不是钢筋或功能区的本地应用程序(诚然,这种应用程序现在有点难找),您可以看到它们具有相同的灰色背景,因此我们决定这是正确的做法。

你应该能够在事件中自己绘制工具栏的背景,但wx默认尝试遵守平台标准,这意味着不使用任何渐变。

问题回答

您想要使用 wxAUIToolbar。它具有您所描述的外观,并且与 wxToolbar 兼容,因此您可以在任何使用 wxToolbar 的地方使用它。

我想给你指一下文档,但是没有。(我自己也有这方面的问题。)





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签