1

我正在尝试创建一个 DevEx 下拉按钮。不幸的是,我遇到了两个我无法弄清楚的问题:

1) 我无法正确设置弹出菜单的外观,即它的外观不是“Office 2010 Blue”。我正在使用的代码如下所示:

        private void InitializeSendToPricingSheetButton()
        {
            var barManager = new BarManager();
            if (barManager.Controller == null) barManager.Controller = new BarAndDockingController();
            barManager.Controller.PaintStyleName = "Skin";
            barManager.Controller.LookAndFeel.UseDefaultLookAndFeel = false;
            barManager.Controller.LookAndFeel.SkinName = "Office 2010 Blue";

            barManager.ItemClick += HandleSendToPricingSheetClick;
            barManager.Items.AddRange(new[] { new BarButtonItem(barManager, "Foo"), new BarButtonItem(barManager, "Bar"), new BarButtonItem(barManager, "Baz") });

            var popupMenu = new PopupMenu { Manager = barManager };
            foreach (var barItem in barManager.Items) popupMenu.ItemLinks.Add((BarItem)barItem);
            popupMenu.ItemLinks[1].BeginGroup = true;

            dropDownButtonSendToPricingSheet.DropDownControl = popupMenu;
        }

2) 此按钮位于表单上。如果表单失去焦点(例如,我单击 Firefox),弹出菜单仍然保持在顶部。在点击之前它不会消失。

任何建议将不胜感激。感谢您帮助我处理 DevEx 的疯狂问题。

4

3 回答 3

2

我有你的第二个问题的解决方案。

您应该添加下拉按钮事件处理程序,如下所示:

dropDownButton1.LostFocus += new EventHandler(HidePopUp);

处理程序方法应如下所示:

private void HidePopUp(object sender,object e)
        {
            dropDownButton1.HideDropDown();
        }
于 2012-09-30T14:49:56.017 回答
1

对于第二个问题,您应该将值分配给 bar manager 属性,如下所示:

BarManager manager = new BarManager();
manager.Form = this; // refers to current form 

查找以下链接以供参考 https://www.devexpress.com/Support/Center/Question/Details/Q274641

于 2014-05-19T15:49:49.160 回答
0

It is probably simpler to use DefaultLookAndFeel

Add this comp to your form and set the theme you'd like to use. There is no need to set the theme for individual components.

defaultLookAndFeel1.LookAndFeel.SetSkinStyle("Office 2010 Blue");
于 2012-09-26T10:52:11.000 回答