Пример #1
0
            /// <summary>
            /// Creates a new instance.
            /// </summary>
            /// <param name="colorEditor">The editor this instance belongs to.</param>
            public ColorUIWrapper(ColorEditorEx colorEditor)
            {
                Type            colorUiType     = typeof(ColorEditor).GetNestedType("ColorUI", BindingFlags.CreateInstance | BindingFlags.NonPublic);
                ConstructorInfo constructorInfo = colorUiType.GetConstructor(new Type[] { typeof(ColorEditor) });

                _control = (Control)constructorInfo.Invoke(new object[] { colorEditor });

                Panel alphaPanel = new Panel();

                alphaPanel.BackColor = SystemColors.Control;
                alphaPanel.Dock      = DockStyle.Right;
                alphaPanel.Width     = 28;
                _control.Controls.Add(alphaPanel);
                _tbAlpha               = new TrackBar();
                _tbAlpha.Orientation   = Orientation.Vertical;
                _tbAlpha.Dock          = DockStyle.Fill;
                _tbAlpha.TickStyle     = TickStyle.None;
                _tbAlpha.Maximum       = byte.MaxValue;
                _tbAlpha.Minimum       = byte.MinValue;
                _tbAlpha.ValueChanged += new EventHandler(OnTrackBarAlphaValueChanged);
                alphaPanel.Controls.Add(_tbAlpha);
                _lblAlpha           = new Label();
                _lblAlpha.Text      = "0";
                _lblAlpha.Dock      = DockStyle.Bottom;
                _lblAlpha.TextAlign = ContentAlignment.MiddleCenter;
                alphaPanel.Controls.Add(_lblAlpha);

                _startMethodInfo   = _control.GetType().GetMethod("Start");
                _endMethodInfo     = _control.GetType().GetMethod("End");
                _valuePropertyInfo = _control.GetType().GetProperty("Value");

                _control.SizeChanged += new EventHandler(OnControlSizeChanged);
            }
Пример #2
0
            /// <summary>
            /// Creates a new instance.
            /// </summary>
            /// <param name="colorEditor">The editor this instance belongs to.</param>
            public ColorUIWrapper(ColorEditorEx colorEditor)
            {
                Type colorUiType = typeof(ColorEditor).GetNestedType("ColorUI", BindingFlags.CreateInstance | BindingFlags.NonPublic);
                ConstructorInfo constructorInfo = colorUiType.GetConstructor(new Type[] { typeof(ColorEditor) });
                _control = (Control)constructorInfo.Invoke(new object[] { colorEditor });

                Panel alphaPanel = new Panel();
                alphaPanel.BackColor = SystemColors.Control;
                alphaPanel.Dock = DockStyle.Right;
                alphaPanel.Width = 28;
                _control.Controls.Add(alphaPanel);
                _tbAlpha = new TrackBar();
                _tbAlpha.Orientation = Orientation.Vertical;
                _tbAlpha.Dock = DockStyle.Fill;
                _tbAlpha.TickStyle = TickStyle.None;
                _tbAlpha.Maximum = byte.MaxValue;
                _tbAlpha.Minimum = byte.MinValue;
                _tbAlpha.ValueChanged += new EventHandler(OnTrackBarAlphaValueChanged);
                alphaPanel.Controls.Add(_tbAlpha);
                _lblAlpha = new Label();
                _lblAlpha.Text = "0";
                _lblAlpha.Dock = DockStyle.Bottom;
                _lblAlpha.TextAlign = ContentAlignment.MiddleCenter;
                alphaPanel.Controls.Add(_lblAlpha);

                _startMethodInfo = _control.GetType().GetMethod("Start");
                _endMethodInfo = _control.GetType().GetMethod("End");
                _valuePropertyInfo = _control.GetType().GetProperty("Value");

                _control.SizeChanged += new EventHandler(OnControlSizeChanged);
            }