|
|
C# Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void pictureBox2_mousehover(object sender, EventArgs e) { } private void pictureBox1_mousehover(object sender, EventArgs e) { <--------------------------------------------------------------------------------------------------hier solll das button grau(undrückbar) werden } private void label1_mousehover(object sender, EventArgs e) { <----------------------------------------------------------------------------------------------------------hier soll das button normal werden } } } |
|
|
C# Quellcode |
1 2 3 4 5 |
// enable: button.Enabled = true; // disable: button.Enabled = false; |
|
|
C# Quellcode |
1 |
button1_click |
|
|
C# Quellcode |
1 |
button1_mousehover |
|
|
C# Quellcode |
1 |
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); |
|
|
C# Quellcode |
1 |
this.pictureBox2.mousehover += new System.EventHandler(this.pictureBox2_mousehover); |
|
|
C# Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void pictureBox2_MouseHover(object sender, EventArgs e) { button1.Enabled = false; } private void pictureBox1_MouseHover(object sender, EventArgs e) { button1.Enabled = false; } private void label1_MouseHover(object sender, EventArgs e) { button1.Enabled = true; } private void button1_Click(object sender, EventArgs e) { } } } |
|
|
C# Quellcode |
1 2 3 4 |
private void button2_MouseMove(object sender, MouseEventArgs e) { button1.Enabled = false; } |
|
|
C# Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
namespace WindowsFormsApplication1 { partial class Form1 { /// <summary> /// Erforderliche Designervariable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Verwendete Ressourcen bereinigen. /// </summary> /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Vom Windows Form-Designer generierter Code /// <summary> /// Erforderliche Methode für die Designerunterstützung. /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage"))); this.pictureBox1.Location = new System.Drawing.Point(0, 42); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(250, 78); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; this.pictureBox1.MouseHover += new System.EventHandler(this.pictureBox1_MouseHover); // // pictureBox2 // this.pictureBox2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox2.BackgroundImage"))); this.pictureBox2.Location = new System.Drawing.Point(42, 142); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(250, 78); this.pictureBox2.TabIndex = 1; this.pictureBox2.TabStop = false; this.pictureBox2.MouseMove += new System.EventHandler(this.pictureBox2_MouseMove); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(8, 10); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(29, 13); this.label1.TabIndex = 2; this.label1.Text = "Start"; this.label1.MouseHover += new System.EventHandler(this.label1_MouseHover); // // button1 // this.button1.Location = new System.Drawing.Point(129, 233); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(142, 26); this.button1.TabIndex = 3; this.button1.Text = "Ziel"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; } } |