'C# Windows Forms Combobox not working correctly
I'm currently working on a backup program. On Friday everything worked without any problems and the project was almost finished.
Today I started Visual Studio without doing anything else. And every combo box I add has the drop-down menu shifted to the right.
I have removed all the code and created new combo boxes, but they are still wrong displayed. I never had this problem before. Maybe it's the Form Designer, I haven't checked it yet. Maybe someone has had this problem before and can help me? I would be very grateful.
public Form1()
{
InitializeComponent();
this.CenterToScreen();
this.MaximizeBox = false;
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.Font = new Font("Arial", 10, FontStyle.Regular);
this.PathSettingsPanel.BackColor = System.Drawing.Color.LightGray;
this.UsernameComboboxCreate.DropDownStyle = ComboBoxStyle.DropDownList;
this.SelectBackupSend.DropDownStyle = ComboBoxStyle.DropDownList;
this.DtDUsernameSource.DropDownStyle = ComboBoxStyle.DropDownList;
this.DtDUsernameTarget.DropDownStyle = ComboBoxStyle.DropDownList;
this.indicator.Text = string.Empty;
this.SendBackupIndicator.Text = string.Empty;
this.IndicatorSource.Text = string.Empty;
this.IndicatorTarget.Text = string.Empty;
this.panel3.BorderStyle = BorderStyle.FixedSingle;
this.panel4.BorderStyle = BorderStyle.FixedSingle;
this.panel5.BorderStyle = BorderStyle.FixedSingle;
this.ServerBackups.View = View.Details;
this.Updating.Visible = true;
this.ServerBackups.UseCellFormatEvents = true;
Serverpath.Text = Main.ReadPathFromFile("server");
PopulateListBoxes();
StartCopy.DoWork += backgroundWorker1_DoWork;
StartCopy.RunWorkerCompleted += backgroundWorker1_RunWorkerCompleted;
StartCopy.WorkerReportsProgress = true;
StartCopy.WorkerSupportsCancellation = true;
FillProgressBar.DoWork += backgroundWorker2_DoWork;
FillProgressBar.RunWorkerCompleted +=
backgroundWorker2_RunWorkerCompleted;
FillProgressBar.ProgressChanged +=
backgroundWorker2_ProgressChanged;
FillProgressBar.WorkerReportsProgress = true;
FillProgressBar.WorkerSupportsCancellation = true;
}
Edit
I've tried a little around. The problem persists even if I create a new project and copy code and forms.
When I create a combobox outside the tab control, it works as it should. Once I click a combobox inside the tab control it will be displayed incorrectly. After that the box which works at the beginning doesn't work anymore.
Okay the problems seems to be the tabcontrol. I just have no idea why.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

