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 03:19 PM UTC

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 03:43 PM UTC

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 03:46 PM UTC

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


AD Administrator Syncfusion Team January 7, 2005 04:33 PM UTC

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 07:05 PM UTC

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.
Up arrow icon