コード例 #1
0
        private void Control_ValueChanging(object sender, System.EventArgs e)
        {
            SlideCtrl    s = sender as SlideCtrl;
            UIFloatParam p = s.Tag as UIFloatParam;

            p.Value = s.GetPos();
        }
コード例 #2
0
        public void DisplayParameters(List <UIBaseParam> _parameters)
        {
            SuspendLayout();

            this.Controls.Clear();

            ResumeLayout();

            int itemElsp = 4;
            int itemY    = itemElsp;
            int itemH    = 16;

            foreach (var p in _parameters)
            {
                if (p is UIFloatParam)
                {
                    var fp = p as UIFloatParam;

                    var slider = new SlideCtrl();
                    slider.Location = new System.Drawing.Point(0, itemY);
                    slider.Height   = itemH;
                    slider.SetRange(fp.MinRange, fp.MaxRange, 0.01f);
                    slider.SetPos(fp.Value);
                    slider.Parent         = this;
                    slider.Text           = p.Name;
                    slider.ValueChanging += Control_ValueChanging;
                    slider.Tag            = p;
                    slider.CreateControl();
                }
                else if (p is UITexture2DParam)
                {
                    var tp = p as UITexture2DParam;

                    var label = new Label();
                    label.Location = new System.Drawing.Point(0, itemY);
                    label.Height   = itemH;
                    label.Parent   = this;
                    label.Text     = tp.Name;
                    label.Tag      = p;
                    label.CreateControl();

                    var textbox = new TextBox();
                    textbox.Location     = new System.Drawing.Point(label.Width + 1, itemY);
                    textbox.Height       = itemH;
                    textbox.Parent       = this;
                    textbox.Text         = tp.Value;
                    textbox.TextChanged += Textbox_TextChanged;
                    textbox.Tag          = p;
                    textbox.CreateControl();
                }

                itemY += (itemH + itemElsp);
            }
        }