Ejemplo n.º 1
0
        /// <summary>
        /// 可见状态改变方法
        /// </summary>
        public override void onVisibleChanged()
        {
            base.onVisibleChanged();
            FCNative native = Native;

            if (native != null)
            {
                if (Visible)
                {
                    if (m_frame == null)
                    {
                        m_frame = new FCWindowFrame();
                    }
                    native.removeControl(this);
                    native.addControl(m_frame);
                    m_frame.Size = native.DisplaySize;
                    if (!m_frame.containsControl(this))
                    {
                        m_frame.addControl(this);
                    }
                }
                else
                {
                    if (m_frame != null)
                    {
                        m_frame.removeControl(this);
                        native.removeControl(m_frame);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 重置缩放尺寸
        /// </summary>
        /// <param name="clientSize">客户端大小</param>
        public void resetScaleSize(FCSize clientSize)
        {
            FCNative native = Native;

            if (native != null)
            {
                FCHost        host         = native.Host;
                FCSize        nativeSize   = native.DisplaySize;
                List <FCView> controls     = native.getControls();
                int           controlsSize = controls.Count;
                for (int i = 0; i < controlsSize; i++)
                {
                    FCWindowFrame frame = controls[i] as FCWindowFrame;
                    if (frame != null)
                    {
                        WindowEx window = frame.getControls()[0] as WindowEx;
                        if (window != null && !window.AnimateMoving)
                        {
                            FCPoint location = window.Location;
                            if (location.x < 10 || location.x > nativeSize.cx - 10)
                            {
                                location.x = 0;
                            }
                            if (location.y < 30 || location.y > nativeSize.cy - 30)
                            {
                                location.y = 0;
                            }
                            window.Location = location;
                        }
                    }
                }
                native.ScaleSize = new FCSize((int)(clientSize.cx * m_scaleFactor), (int)(clientSize.cy * m_scaleFactor));
                native.update();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 销毁控件方法
 /// </summary>
 public override void delete()
 {
     if (!IsDeleted)
     {
         if (m_frame != null)
         {
             m_frame.removeControl(this);
             Native.removeControl(m_frame);
             m_frame.delete();
             m_frame = null;
         }
     }
     base.delete();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 关闭窗体
        /// </summary>
        public virtual void close()
        {
            bool cancel = false;

            onWindowClosing(ref cancel);
            if (!cancel)
            {
                if (m_frame != null)
                {
                    m_frame.removeControl(this);
                    Native.removeControl(m_frame);
                    m_frame.delete();
                    m_frame = null;
                    Parent  = null;
                }
                else
                {
                    Native.removeControl(this);
                }
                onWindowClosed();
            }
        }