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
close icon

BarItem Blink

i want to blink one baritem. the problem is: i don''t know how to force a repaint. i use this code with a workaround: bool bLastBlink = false; private void barItemZurück_DrawToolbarItem(object sender, Syncfusion.Windows.Forms.Tools.XPMenus.DrawToolbarItemEventArgs drawItemInfo) { drawItemInfo.DrawBackground(); Graphics g = drawItemInfo.Graphics; if (bLastBlink) g.FillRectangle(brushRed, drawItemInfo.Bounds.X, drawItemInfo.Bounds.Y, drawItemInfo.Bounds.Width, drawItemInfo.Bounds.Height); drawItemInfo.DrawBorders(); drawItemInfo.DrawInterior(); } private void timerBlink_Tick(object sender, System.EventArgs e) { bLastBlink = !bLastBlink; barItemZurück.Text = barItemZurück.Text + " "; // HACK: please fix } i use this to force a repaint: barItemZurück.Text = barItemZurück.Text + " "; how can i do it the right way???

5 Replies

AD Administrator Syncfusion Team April 19, 2005 04:13 PM UTC

Hi Christian, Have you tried calling Invalidate() on the bar that the BarItem is part of? That should solve your problem, though if you''re using MainFrameBarManager you''ll need to use the GetBarControl method first to get a reference to the actual control used to display the Bar. Regards, Gregory Austin Syncfusion Inc.


AD Administrator Syncfusion Team April 20, 2005 03:33 PM UTC

hi, i''m using a childframebarmanager. getbarcontrol gives me a null reference. what should i do??? >Hi Christian, > > Have you tried calling Invalidate() on the bar that the BarItem is part of? That should solve your problem, though if you''re using MainFrameBarManager you''ll need to use the GetBarControl method first to get a reference to the actual control used to display the Bar. > >Regards, >Gregory Austin >Syncfusion Inc.


AD Administrator Syncfusion Team April 20, 2005 07:25 PM UTC

Hi, Did you create a Bar with the same name in the MainFrameBarManager as your Bar in the ChildFrameBarManager? That might solve your problem. Alternatively, you could just update every Bar Control with the following code snippet: foreach (Bar b in this.mainFrameBarManager1.Bars) { this.mainFrameBarManager1.GetBarControl(b).Invalidate(); } If neither of these works, could you send me a sample so that I could take a look at your application? Regards, Gregory Austin Syncfusion Inc.


CP Christian Pogea April 21, 2005 11:17 AM UTC

sorry, it doesn''t work. please use my sample to get it work for me. best ragards, christian pogea BarBlink_9705.zip


AD Administrator Syncfusion Team April 21, 2005 03:32 PM UTC

Hi Christian, I''ve looked into this further and discovered that the Bar only repaints the BarItem when one of it''s properties is changed. So to get a BarItem to repaint, you need to fire a PropertyChanged event. Do this, you need to extend the class. The following code snippet is an extension of BarItem that adds the Blink property. Changing this property will cause the BarItem to be repainted. public class BlinkBarItem : Syncfusion.Windows.Forms.Tools.XPMenus.BarItem { public BlinkBarItem() : base() { } private bool blink; public bool Blink { get { return blink; } set { if (blink != value) { blink = value; this.OnPropertyChanged(new Syncfusion.ComponentModel.SyncfusionPropertyChangedEventArgs(Syncfusion.ComponentModel.PropertyChangeEffect.NeedLayout, "Blink", !blink, blink)); } } } } Regards, Gregory Austin Syncfusion Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon