backgroundImage
以下のように、ホバー時にボタン のプロパティを変更したい:
private void btnGetHardwareID_MouseEnter(object sender, EventArgs e)
{
btnGetHardwareID.BackgroundImage = (System.Drawing.Image)(Properties.Resources._11949847771696668271pill_button_green_benji__01_svg_med);
btnGetHardwareID.Refresh();
}
private void btnGetHardwareID_MouseLeave(object sender, EventArgs e)
{
btnGetHardwareID.BackgroundImage = (System.Drawing.Image)(Properties.Resources._11949847771793996117pill_button_purple_benji_01_svg_med);
btnGetHardwareID.Refresh();
}
btnGetHardwareID のプロパティは次のようになります。
// btnGetHardwareID
//
this.btnGetHardwareID.BackColor = System.Drawing.Color.Transparent;
this.btnGetHardwareID.BackgroundImage = global::Travian.Properties.Resources._11949847771793996117pill_button_purple_benji_01_svg_med;
this.btnGetHardwareID.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btnGetHardwareID.FlatAppearance.BorderSize = 0;
this.btnGetHardwareID.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnGetHardwareID.Font = new System.Drawing.Font("Cambria", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnGetHardwareID.ForeColor = System.Drawing.Color.White;
this.btnGetHardwareID.Location = new System.Drawing.Point(31, 53);
this.btnGetHardwareID.Name = "btnGetHardwareID";
this.btnGetHardwareID.Size = new System.Drawing.Size(160, 40);
this.btnGetHardwareID.TabIndex = 25;
this.btnGetHardwareID.Text = "Get My Hardware-ID";
this.btnGetHardwareID.UseVisualStyleBackColor = false;
this.btnGetHardwareID.Click += new System.EventHandler(this.btnGetHardwareID_Click);
this.btnGetHardwareID.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnGetHardwareID_MouseDown);
this.btnGetHardwareID.MouseEnter += new System.EventHandler(this.btnGetHardwareID_MouseEnter);
this.btnGetHardwareID.MouseLeave += new System.EventHandler(this.btnGetHardwareID_MouseLeave);
this.btnGetHardwareID.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnGetHardwareID_MouseUp);
問題は、MouseEnter の backgroundImage が次のようになっていることです。
そしてMouseLeaveでは次のようになります:
緑色のボタンの周りの灰色の BackColor は何ですか?どうすればそれを削除できますか?
元の画像を編集
すると、次のようになります。
そしてその MainForm の背景:
前もって感謝します