Esempio n. 1
0
 public void SelectControl()
 {
     if (m_xOverlay != null)
     {
         XRegion xRegion = (XRegion)m_xOverlay.First();
         for (int n = 0; n < m_xOverlay.Count; n++)
         {
             if (xRegion != null)
             {
                 if (xRegion.InnerRegion(m_xSelectRegion.X, m_xSelectRegion.Y, m_xSelectRegion.W, m_xSelectRegion.H) == true)
                 {
                     xRegion.ControlSelect = REGION_CONTROL_STYLES.MC;
                     AddSelect(xRegion);
                 }
                 xRegion = (XRegion)m_xOverlay.Next();
             }
         }
     }
 }
Esempio n. 2
0
        private void LButtonDown(PointF point)
        {
            if (m_xOverlay != null)
            {
                m_xActiveRegion = null;
                XRegion xRegion = (XRegion)m_xOverlay.First();
                for (int n = 0; n < m_xOverlay.Count; n++)
                {
                    if (xRegion != null)
                    {
                        if (REGION_CONTROL_STYLES.NONE != xRegion.SelectControl(point.X / m_fZ, point.Y / m_fZ, xRegion.Spaces / m_fZ, ModifierKeys))
                        {
                            m_xActiveRegion = xRegion;
                            break;
                        }
                        else if (REGION_CONTROL_STYLES.NONE != xRegion.ControlSelect)
                        {
                            if (m_xActiveRegion == null)
                            {
                                m_xActiveRegion = xRegion;
                            }
                            else
                            {
                                if (m_xActiveRegion.ControlSelect == REGION_CONTROL_STYLES.MC &&
                                    (xRegion.ControlSelect != REGION_CONTROL_STYLES.MC ||
                                     xRegion.InnerRegion(m_xActiveRegion) == true))
                                {
                                    m_xActiveRegion.ControlSelect = REGION_CONTROL_STYLES.NONE;
                                    m_xActiveRegion = xRegion;
                                }
                                else
                                {
                                    xRegion.ControlSelect = REGION_CONTROL_STYLES.NONE;
                                }
                            }
                        }
                        xRegion = (XRegion)m_xOverlay.Next();
                    }
                }

                if (ModifierKeys != Keys.Alt)
                {
                    if (m_xActiveRegion == null)
                    {
                        m_xSelect.Empty();
                        m_xSelectRegion.Set(point.X / m_fZ, point.Y / m_fZ, 1, 1, 0);
                        m_xSelectRegion.SelectControl(point.X / m_fZ, point.Y / m_fZ, m_xSelectRegion.Spaces / m_fZ, ModifierKeys);
                        m_xSelectRegion.ControlStyle  = REGION_CONTROL_STYLES.BR;
                        m_xSelectRegion.ControlSelect = REGION_CONTROL_STYLES.BR;
                    }
                    else
                    {
                        if (ModifierKeys == Keys.Control || m_xSelect.Count > 1)
                        {
                            AddSelect(m_xActiveRegion);
                            float  fCx = m_xActiveRegion.X;
                            float  fCy = m_xActiveRegion.Y;
                            PointF Fix = m_xActiveRegion.Fix;
                            xRegion = (XRegion)m_xSelect.First();
                            for (int n = 0; n < m_xSelect.Count; n++)
                            {
                                if (xRegion != null)
                                {
                                    xRegion.ControlSelect = m_xActiveRegion.ControlSelect;
                                    if (m_xActiveRegion.ControlSelect == REGION_CONTROL_STYLES.MC)
                                    {
                                        PointF FixN = new PointF(Fix.X - fCx + xRegion.X, Fix.Y - fCy + xRegion.Y);
                                        xRegion.Fix = FixN;
                                    }
                                    xRegion = (XRegion)m_xSelect.Next();
                                }
                            }
                        }
                        else
                        {
                            xRegion = (XRegion)m_xOverlay.First();
                            for (int n = 0; n < m_xOverlay.Count; n++)
                            {
                                if (xRegion != null)
                                {
                                    if (m_xActiveRegion != xRegion && m_xSelect.Count == 1)
                                    {
                                        xRegion.ControlSelect = REGION_CONTROL_STYLES.NONE;
                                    }
                                    xRegion = (XRegion)m_xOverlay.Next();
                                }
                            }
                            m_xSelect.Empty();
                            AddSelect(m_xActiveRegion);
                        }
                        m_xOverlay.Exchange(m_xOverlay.First(), m_xActiveRegion);
                    }
                    Refresh();
                }
            }
        }