Beispiel #1
0
        /// <summary>
        /// 拖动结束方法
        /// </summary>
        public override void OnDragEnd()
        {
            base.OnDragEnd();
            ControlA parent = Parent;

            parent.Update();
            parent.Invalidate();
        }
Beispiel #2
0
        /// <summary>
        /// 拖动中方法
        /// </summary>
        public override void OnDragging()
        {
            base.OnDragging();
            ControlA        parent       = Parent;
            ControlHost     host         = Native.Host;
            RECT            tempRect     = new RECT();
            RECT            bounds       = Bounds;
            List <ControlA> controls     = parent.m_controls;
            int             controlsSize = controls.Count;
            int             thisIndex    = -1;

            for (int i = 0; i < controlsSize; i++)
            {
                ControlA iControl = controls[i];
                if (iControl == this)
                {
                    thisIndex = i;
                    break;
                }
            }
            int mx = bounds.left + (bounds.right - bounds.left) / 2;
            int my = bounds.top + (bounds.bottom - bounds.top) / 2;

            for (int i = 0; i < controlsSize; i++)
            {
                ControlA iCell = controls[i];
                if (iCell != this && !(iCell is ScrollBarA))
                {
                    RECT iBounds = iCell.Bounds;
                    if (host.GetIntersectRect(ref tempRect, ref bounds, ref iBounds) > 0)
                    {
                        if (mx >= iBounds.left && mx <= iBounds.right && my >= iBounds.top && my <= iBounds.bottom)
                        {
                            controls[thisIndex] = iCell;
                            controls[i]         = this;
                            RECT oldBounds = iCell.Bounds;
                            iCell.Bounds = m_paintRect;
                            m_paintRect  = oldBounds;
                            parent.Invalidate();
                            break;
                        }
                    }
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// 刷新界面
 /// </summary>
 /// <param name="var">变量</param>
 /// <returns>状态</returns>
 private double INVALIDATE(CVariable var)
 {
     if (m_xml != null)
     {
         int pLen = var.m_parameters != null ? var.m_parameters.Length : 0;
         if (pLen == 0)
         {
             m_xml.Native.Invalidate();
         }
         else
         {
             ControlA control = m_xml.FindControl(m_indicator.GetText(var.m_parameters[0]));
             if (control != null)
             {
                 control.Invalidate();
             }
         }
     }
     return(0);
 }