public ScopeAttributeEditDialog(ScopeAttribute scope)
 {
     _scope = scope;
     InitializeComponent();
     textBox1.Text = _scope.Min.ToString();
     textBox2.Text = _scope.Max.ToString();
 }
 protected override bool ProcessDialogKey(Keys keyData)
 {
     if (keyData == Keys.Escape)
     {
         _oldScope  = _newScope;
         cancelling = true;
     }
     return(base.ProcessDialogKey(keyData));
 }
Ejemplo n.º 3
0
 public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
 {
     if (value is string)
     {
         String[] v = ((String)value).Split(',');
         if (v.GetLength(0) != 2)
         {
             throw new ArgumentException("非法的参数格式");
         }
         ScopeAttribute csf = new ScopeAttribute();
         csf.Min = Convert.ToInt32(v[0]);
         csf.Max = Convert.ToInt32(v[1]);
         return(csf);
     }
     return(base.ConvertFrom(context, culture, value));
 }
Ejemplo n.º 4
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            String result = "";

            if (destinationType == typeof(String))
            {
                ScopeAttribute scope = value as ScopeAttribute;
                result = scope.Min.ToString() + "," + scope.Max.ToString();
                return(result);
            }
            if (destinationType == typeof(InstanceDescriptor))
            {
                ConstructorInfo ci    = typeof(ScopeAttribute).GetConstructor(new Type[] { typeof(Int32), typeof(Int32) });
                ScopeAttribute  scope = value as ScopeAttribute;
                return(new InstanceDescriptor(ci, new object[] { scope.Min, scope.Max }));
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Ejemplo n.º 5
0
 public void InitializeComponent()
 {
     SampleControl.ScopeAttribute scopeAttribute1 = new SampleControl.ScopeAttribute();
     this.thermoMeterControl1 = new SampleControl.ThermoMeterControl();
     this.myClock1            = new SampleControl.MyClock();
     this.myLabel1            = new SampleControl.MyLabel();
     this.myControl           = new SampleControl.FirstControl();
     this.myTrackBar          = new SampleControl.FlashTrackBar();
     this.myButton            = new SampleControl.MyButton();
     this.myListControl       = new SampleControl.MyListControl();
     this.SuspendLayout();
     //
     // thermoMeterControl1
     //
     this.thermoMeterControl1.BigScale         = 5;
     this.thermoMeterControl1.BigScaleColor    = System.Drawing.Color.MediumBlue;
     this.thermoMeterControl1.DialBackColor    = System.Drawing.Color.Gray;
     this.thermoMeterControl1.DialOutLineColor = System.Drawing.Color.Gray;
     this.thermoMeterControl1.DrawColor        = System.Drawing.Color.Black;
     this.thermoMeterControl1.DrawFont         = new System.Drawing.Font("Microsoft Sans Serif", 9F);
     this.thermoMeterControl1.HighTemperature  = 100F;
     this.thermoMeterControl1.Location         = new System.Drawing.Point(346, 211);
     this.thermoMeterControl1.LowTemperature   = 0F;
     this.thermoMeterControl1.MercuryBackColor = System.Drawing.Color.LightGray;
     this.thermoMeterControl1.MercuryColor     = System.Drawing.Color.Red;
     this.thermoMeterControl1.Name             = "thermoMeterControl1";
     this.thermoMeterControl1.Size             = new System.Drawing.Size(58, 200);
     this.thermoMeterControl1.SmallScale       = 5;
     this.thermoMeterControl1.SmallScaleColor  = System.Drawing.Color.DarkOrange;
     this.thermoMeterControl1.TabIndex         = 5;
     this.thermoMeterControl1.TempColor        = System.Drawing.Color.Black;
     this.thermoMeterControl1.Temperature      = 0F;
     this.thermoMeterControl1.TempFont         = new System.Drawing.Font("宋体", 12F);
     //
     // myClock1
     //
     this.myClock1.ClockForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
     this.myClock1.HourColor      = System.Drawing.Color.Lime;
     this.myClock1.Location       = new System.Drawing.Point(246, 12);
     this.myClock1.MinuteColor    = System.Drawing.Color.Blue;
     this.myClock1.Name           = "myClock1";
     this.myClock1.SecondColor    = System.Drawing.Color.Red;
     this.myClock1.Size           = new System.Drawing.Size(200, 200);
     this.myClock1.TabIndex       = 4;
     this.myClock1.Text           = "myClock1";
     this.myClock1.MouseDown     += new System.Windows.Forms.MouseEventHandler(this.mouseDownEvent);
     this.myClock1.MouseMove     += new System.Windows.Forms.MouseEventHandler(this.mouseMoveEvent);
     this.myClock1.MouseUp       += new System.Windows.Forms.MouseEventHandler(this.mouseUpEvent);
     //
     // myLabel1
     //
     this.myLabel1.AutoSize       = true;
     this.myLabel1.ClockBackColor = System.Drawing.Color.DarkSlateGray;
     this.myLabel1.ClockForeColor = System.Drawing.Color.LavenderBlush;
     this.myLabel1.Location       = new System.Drawing.Point(27, 127);
     this.myLabel1.Margin         = new System.Windows.Forms.Padding(0);
     this.myLabel1.Name           = "myLabel1";
     this.myLabel1.Size           = new System.Drawing.Size(97, 20);
     this.myLabel1.TabIndex       = 2;
     //
     // myControl
     //
     this.myControl.BackColor     = System.Drawing.Color.Cornsilk;
     this.myControl.Location      = new System.Drawing.Point(75, 82);
     this.myControl.Name          = "myControl";
     this.myControl.Size          = new System.Drawing.Size(98, 28);
     this.myControl.TabIndex      = 0;
     this.myControl.Text          = "Hello,I am the firstControl!";
     this.myControl.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
     this.myControl.MouseDown    += new System.Windows.Forms.MouseEventHandler(this.mouseDownEvent);
     this.myControl.MouseMove    += new System.Windows.Forms.MouseEventHandler(this.mouseMoveEvent);
     this.myControl.MouseUp      += new System.Windows.Forms.MouseEventHandler(this.mouseUpEvent);
     //
     // myTrackBar
     //
     this.myTrackBar.AllowDrop      = true;
     this.myTrackBar.AllowUserEdit  = false;
     this.myTrackBar.BackColor      = System.Drawing.Color.Black;
     this.myTrackBar.DarkenBy       = ((byte)(255));
     this.myTrackBar.ForeColor      = System.Drawing.Color.White;
     this.myTrackBar.Location       = new System.Drawing.Point(27, 43);
     this.myTrackBar.Name           = "myTrackBar";
     this.myTrackBar.ShowPercentage = true;
     this.myTrackBar.Size           = new System.Drawing.Size(146, 20);
     this.myTrackBar.TabIndex       = 1;
     this.myTrackBar.Text           = "程序进度条";
     //
     // myButton
     //
     this.myButton.BackColor         = System.Drawing.Color.SandyBrown;
     this.myButton.ButtonBorder      = 1;
     this.myButton.ButtonBorderColor = System.Drawing.Color.Sienna;
     this.myButton.Cursor            = System.Windows.Forms.Cursors.Default;
     this.myButton.Location          = new System.Drawing.Point(-3, 178);
     this.myButton.Name     = "myButton";
     this.myButton.Size     = new System.Drawing.Size(107, 51);
     this.myButton.TabIndex = 3;
     this.myButton.Text     = "I am a button";
     this.myButton.UseVisualStyleBackColor = false;
     //
     // myListControl
     //
     this.myListControl.BackColor = System.Drawing.SystemColors.Control;
     this.myListControl.Cursor    = System.Windows.Forms.Cursors.Default;
     this.myListControl.ForeColor = System.Drawing.Color.Cornsilk;
     this.myListControl.Location  = new System.Drawing.Point(195, 237);
     this.myListControl.Name      = "myListControl";
     scopeAttribute1.Max          = 100;
     scopeAttribute1.Min          = 3;
     this.myListControl.Scope     = scopeAttribute1;
     this.myListControl.Size      = new System.Drawing.Size(30, 100);
     this.myListControl.TabIndex  = 6;
     //
     // MyForm
     //
     this.ClientSize = new System.Drawing.Size(448, 423);
     this.Controls.Add(this.thermoMeterControl1);
     this.Controls.Add(this.myClock1);
     this.Controls.Add(this.myLabel1);
     this.Controls.Add(this.myControl);
     this.Controls.Add(this.myTrackBar);
     this.Controls.Add(this.myButton);
     this.Controls.Add(this.myListControl);
     this.Location = new System.Drawing.Point(300, 100);
     this.Name     = "MyForm";
     this.Text     = "控件窗口";
     this.ResumeLayout(false);
     this.PerformLayout();
 }
 public ScopeAttributeEditorControl(ScopeAttribute scope)
 {
     _oldScope = scope;
     _newScope = scope;
     InitializeComponent();
 }