Ejemplo n.º 1
0
        private static void setControl(ConfigControlsEntity c)
        {
            if (_controls != null)
            {
                object controlobj;
                try
                {
                    if (string.IsNullOrWhiteSpace(c.AssembleFile))
                    {
                        string[] _t = c.AssembleString.Split('.');
                        controlobj = System.Reflection.Assembly.Load(_t[0]).CreateInstance(c.AssembleString);
                    }
                    else
                    {
                        controlobj = System.Reflection.Assembly.LoadFrom(c.AssembleFile).CreateInstance(c.AssembleString);
                    }
                    if (controlobj == null)
                    {
                        controlobj = new ctrlBaseDebug();
                        string msg = string.Format("创建控件{0}失败:\r\n无法找到该控件!", c.AssembleString);
                        ((ctrlBaseDebug)controlobj).setText(msg);
                    }
                }
                catch (Exception ex)
                {
                    controlobj = new ctrlBaseDebug();
                    string msg = string.Format("创建控件{0}失败:\r\n{1}", c.AssembleString, ex.Message);
                    ((ctrlBaseDebug)controlobj).setText(msg);
                }

                Rmes.WinForm.Base.BaseControl control = controlobj as BaseControl;
                if (c.Width < 0)
                {
                    c.Width = mainform.ClientRectangle.Width - c.Left;
                }
                if (c.Height < 0)
                {
                    c.Height = mainform.ClientRectangle.Height - c.Top;
                }
                if (c.Top < 0)
                {
                    c.Top = mainform.ClientRectangle.Height - c.Height;
                }
                if (c.Left < 0)
                {
                    c.Left = mainform.ClientRectangle.Width - c.Width;
                }
                control.Bounds = new Rectangle(c.Left, c.Top, c.Width, c.Height);
                control.Name   = c.AssembleString;
                _controls.Add(control);
            }
        }
Ejemplo n.º 2
0
        public void Save()
        {
            if (!debugmode)
            {
                return;
            }
            ConfigControlsEntity en = this.OBJ as ConfigControlsEntity;

            if (en != null)
            {
                BaseControlFactory.SaveFormControlsInfo(en);
            }
            base.Dispose();
        }
Ejemplo n.º 3
0
        void ctrlBaseDebug_Resize(object sender, EventArgs e)
        {
            if (!debugmode)
            {
                return;
            }
            ConfigControlsEntity en = this.OBJ as ConfigControlsEntity;

            if (en == null)
            {
                return;
            }
            ((ConfigControlsEntity)this.OBJ).Width  = this.Width;
            ((ConfigControlsEntity)this.OBJ).Height = this.Height;
            //throw new NotImplementedException();
        }
Ejemplo n.º 4
0
        void ctrlBaseDebug_Move(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            if (!debugmode)
            {
                return;
            }
            ConfigControlsEntity en = this.OBJ as ConfigControlsEntity;

            if (en == null)
            {
                return;
            }
            ((ConfigControlsEntity)this.OBJ).Top  = this.Top < 0?0:this.Top;
            ((ConfigControlsEntity)this.OBJ).Left = this.Left < 0?0:this.Left;
        }