Transparent Text in controls if [StatThread] is used

G

Guest

I need help with transparent text in controls. Suddenly text in controls like
listboxes and messageboxes have become transparent. Applications that has
been working for over a year, just stopped working without anyone has changed
the code or recompiled them. If I remove [StatThread] above the main method
the text become visible. I'm not sure what [StatThread] means, but I do know
that it is required when implementing drag and drop functionallity. This is a
small test app where this behaviour occurs.

using System;
using System.Windows.Forms;

namespace HelloWorld
{
public class Form1 : System.Windows.Forms.Form
{
public Form1(){InitializeComponent();}

[STAThread] //Remove to see the MessageBox
static void Main()
{
Application.Run(new Form1());
}

private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Form1_Load);
}

private void Form1_Load(object sender, System.EventArgs e)
{
MessageBox.Show("HelloWorld");
}
}
}
 
H

Herfried K. Wagner [MVP]

Mattias said:
I need help with transparent text in controls. Suddenly text
in controls like listboxes and messageboxes have become
transparent.

If you are using a virus scanner like McAfee AntiVirus 8, turn off buffer
overflow protection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top