We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Changing XPMenu Bar''s Background

I''m trying to change the background color of an XPMenu Bar. There are some instructions in message #18770, but I implemented it as: bar1.DrawBackground += new PaintEventHandler(bar_DrawBackground); CommandBarExt cmdbar = bar1.Manager.GetBarControl(bar1) as CommandBarExt; BarControlInternal bci = cmdbar.BarControl; bci.Paint += new PaintEventHandler(BarControl_Paint); But cmdbar is "null". I''m using this in a demo very soon... Thanks so much, Dan

5 Replies

AD Administrator Syncfusion Team January 7, 2005 10:19 AM

Hi Dan, Yes, it is possible to draw the background of a Bar as exlained in the following forum post : DrawBackground event in Bar class The XPMenus.Bar internally uses the CommandbarExt and hence it cannot be null as long a Bar exists on the form. Could you please send us a test sample that shows this issue ? We appreciate your cooperation. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team January 7, 2005 10:43 AM

Ahhh. It seems that it initiailzies the Bar after _Load, so I need to do that initialization later. Is there a particular step during a form''s setup where it is guaranteed to be safe?


AD Administrator Syncfusion Team January 7, 2005 10:46 AM

(The sample in the linked message gives a 404 Not Found)


AD Administrator Syncfusion Team January 7, 2005 11:33 AM

I think I''ve figured it out. For anyone else''s future reference: private void childFrameBarManager1_BarControlBindingChanged(object sender, Syncfusion.Windows.Forms.Tools.XPMenus.BarControlBindingChangedArgs args) { if(args.ChangeType==Syncfusion.Windows.Forms.Tools.XPMenus.BarControlBindingChangeType.Parented) { Bar bar = args.Bar; Control barcontrol = args.BarControl; bar.DrawBackground += new PaintEventHandler(bar_DrawBackground); CommandBarExt cmdbar = barcontrol as CommandBarExt; BarControlInternal bci = cmdbar.BarControl; bci.Paint += new PaintEventHandler(BarControl_Paint); } else _log.Debug("BCBC BC null"); }


AD Administrator Syncfusion Team January 7, 2005 02:05 PM

Hi Dan, Thanks for sharing this information with us. The sample in the above mentioned forum post can be accessed at : XPMenus Bar Painting Sample We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon