I have a problem that I simply cannot solve. The controls of a form are not displayed. Where could the error be? Unfortunately, I could not find any solutions here. I would be grateful if one of the professionals here could help me.
Form:
using System; using System.Drawing; using System.Windows.Forms; namespace Custom_Messagebox { public partial class MessageBox_1 : Form { private void EXIT_btn_MouseHover(object sender, EventArgs e) { EXIT_btn.BackgroundImage = Custom_Messagebox.Properties.Resources.exit_over; } private void EXIT_btn_Click(object sender, EventArgs e) { this.Close(); } private void EXIT_btn_MouseDown(object sender, MouseEventArgs e) { EXIT_btn.BackgroundImage = Custom_Messagebox.Properties.Resources.exit_down; } private void MessageBox_1_Load(object sender, EventArgs e) { } } }
Designer
namespace Custom_Messagebox { partial class MessageBox_1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.EXIT_btn = new System.Windows.Forms.Button(); this.MessageBox_1_title = new System.Windows.Forms.Label(); this.Message_lbl = new System.Windows.Forms.Label(); this.SuspendLayout(); // // EXIT_btn // this.EXIT_btn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.EXIT_btn.BackgroundImage = global::Custom_Messagebox.Properties.Resources.exit; this.EXIT_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.EXIT_btn.Location = new System.Drawing.Point(503, 6); this.EXIT_btn.Name = "EXIT_btn"; this.EXIT_btn.Size = new System.Drawing.Size(25, 23); this.EXIT_btn.TabIndex = 0; this.EXIT_btn.UseVisualStyleBackColor = true; this.EXIT_btn.Click += new System.EventHandler(this.EXIT_btn_Click); this.EXIT_btn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.EXIT_btn_MouseDown); this.EXIT_btn.MouseHover += new System.EventHandler(this.EXIT_btn_MouseHover); // // MessageBox_1_title // this.MessageBox_1_title.AutoSize = true; this.MessageBox_1_title.BackColor = System.Drawing.Color.Transparent; this.MessageBox_1_title.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.MessageBox_1_title.Location = new System.Drawing.Point(22, 11); this.MessageBox_1_title.Name = "MessageBox_1_title"; this.MessageBox_1_title.Size = new System.Drawing.Size(32, 13); this.MessageBox_1_title.TabIndex = 1; this.MessageBox_1_title.Text = "Titel"; // // Message_lbl // this.Message_lbl.AutoSize = true; this.Message_lbl.BackColor = System.Drawing.Color.Transparent; this.Message_lbl.Location = new System.Drawing.Point(55, 64); this.Message_lbl.Name = "Message_lbl"; this.Message_lbl.Size = new System.Drawing.Size(50, 13); this.Message_lbl.TabIndex = 2; this.Message_lbl.Text = "Message"; // // MessageBox_1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.BackgroundImage = global::Custom_Messagebox.Properties.Resources.weave; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.ClientSize = new System.Drawing.Size(550, 300); this.Controls.Add(this.Message_lbl); this.Controls.Add(this.MessageBox_1_title); this.Controls.Add(this.EXIT_btn); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.Name = "MessageBox_1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MessageBox_1"; this.TransparencyKey = System.Drawing.Color.Red; this.Load += new System.EventHandler(this.MessageBox_1_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button EXIT_btn; private System.Windows.Forms.Label MessageBox_1_title; private System.Windows.Forms.Label Message_lbl; } }