示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ControlSwapper"/> class.
        /// </summary>
        /// <param name="orig">The orig.</param>
        /// <remarks></remarks>
        public ControlSwapper(Control orig)
        {
            InitializeComponent();

            labelOrigType.Dock = DockStyle.Top;
            labelOrigType.Text = orig.GetType().ToString();
            if (orig is DataValues)
            {
                labelOrigType.Text += "." + ((DataValues)orig).ValueType;
            }

            orig.Enabled = false;
            this.splitContainer1.Panel1.Controls.Add(orig);
            this.splitContainer1.Panel1.Controls[this.splitContainer1.Panel1.Controls.Count - 1].BringToFront();
            this.splitContainer1.Panel2.Controls.Add(sBox = new selectionBox());

            foreach (string o in Enum.GetNames(typeof(IFPIO.ObjectEnum)))
            {
                dataTypeStruct dts = new dataTypeStruct();
                dts.name = o;
                dts.size = getSizeOf(o);
                dataTypes.Add(dts);
            }

            getDataOf(orig, ref name, ref controlSize, ref chunkoffset, ref lineNum);
            if (controlSize == -1)
            {
                MessageBox.Show("Unknown control size. Make sure all changes are of equal size!");
                controlSize = Int32.MinValue;
            }

            this.label1.Text = "Original Control Size: " + controlSize;
            try
            {
                this.sBox.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
                this.sBox.comboBox1.DataSource    = dataTypes;
                this.sBox.comboBox1.DisplayMember = "Name";
                this.sBox.comboBox1.ValueMember   = "Size";
            }
            catch (Exception e)
            {
                Global.ShowErrorMsg(e.Message, e);
            }

            // this.sBox.comboBox1.Items.AddRange(dataTypes.ToArray());
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ControlSwapper"/> class.
        /// </summary>
        /// <param name="orig">The orig.</param>
        /// <remarks></remarks>
        public ControlSwapper(Control orig)
        {
            InitializeComponent();

            labelOrigType.Dock = DockStyle.Top;
            labelOrigType.Text = orig.GetType().ToString();
            if (orig is DataValues)
            {
                labelOrigType.Text += "." + ((DataValues)orig).ValueType;
            }

            orig.Enabled = false;
            this.splitContainer1.Panel1.Controls.Add(orig);
            this.splitContainer1.Panel1.Controls[this.splitContainer1.Panel1.Controls.Count - 1].BringToFront();
            this.splitContainer1.Panel2.Controls.Add(sBox = new selectionBox());

            foreach (string o in Enum.GetNames(typeof(IFPIO.ObjectEnum)))
            {
                dataTypeStruct dts = new dataTypeStruct();
                dts.name = o;
                dts.size = getSizeOf(o);
                dataTypes.Add(dts);
            }

            getDataOf(orig, ref name, ref controlSize, ref chunkoffset, ref lineNum);
            if (controlSize == -1)
            {
                MessageBox.Show("Unknown control size. Make sure all changes are of equal size!");
                controlSize = Int32.MinValue;
            }

            this.label1.Text = "Original Control Size: " + controlSize;
            try
            {
                this.sBox.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
                this.sBox.comboBox1.DataSource = dataTypes;
                this.sBox.comboBox1.DisplayMember = "Name";
                this.sBox.comboBox1.ValueMember = "Size";
            }
            catch (Exception e)
            {
                Global.ShowErrorMsg(e.Message, e);
            }

            // this.sBox.comboBox1.Items.AddRange(dataTypes.ToArray());
        }