Esempio n. 1
0
 /// <summary>
 /// Makes main form repaint a set of controls.
 /// </summary>
 internal virtual void MakeControlsPaint(ReadOnlyCollection <ControlToPaint> ctrls)
 {
     if (parent != null)
     {
         parent.MakeControlsPaint(ctrls);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Actual timer event handler, so first-level handler can deal only with exception wrapping.
        /// </summary>
        private void doTimerEvent()
        {
            List <ZenControlBase> subscribers;

            lock (timerSubscribers)
            {
                subscribers = new List <ZenControlBase>(timerSubscribers);
            }
            List <ZenControlBase.ControlToPaint> ctrlsToPaint = new List <ZenControlBase.ControlToPaint>();

            foreach (ZenControlBase ctrl in subscribers)
            {
                bool?      needBackground;
                RenderMode?renderMode;
                ctrl.DoTimer(out needBackground, out renderMode);
                if (renderMode != null)
                {
                    ctrlsToPaint.Add(new ZenControlBase.ControlToPaint(ctrl, needBackground.Value, renderMode.Value));
                }
            }
            // If any controls requested a pain callback, do it
            if (ctrlsToPaint.Count != 0)
            {
                parent.MakeControlsPaint(new ReadOnlyCollection <ZenControlBase.ControlToPaint>(ctrlsToPaint));
            }
            // Start counting again
            timer.Start();
        }
Esempio n. 3
0
        /// <summary>
        /// Triggers a callback to control's <see cref="DoPaint"/>, then re-renders canvas.
        /// </summary>
        /// <param name="needBackground">If true, full canvas is repainted to control can render over stuff outside it's own rectangle.</param>
        /// <param name="rm">Determines when canvas is re-rendered after painting.</param>
        protected void MakeMePaint(bool needBackground, RenderMode rm)
        {
            // Request comes from background thread. In the UI thread, parent may just have been removed.
            // If I have no parent, silently do not invoke.
            // Happens when an animation is in progress and user switches to different tab in top form
            ZenControlBase parent = Parent;

            if (parent != null)
            {
                ControlToPaint[] ctrls = new ControlToPaint[1];
                ctrls[0] = new ControlToPaint(this, needBackground, rm);
                parent.MakeControlsPaint(new ReadOnlyCollection <ControlToPaint>(ctrls));
            }
        }