Click here to Skip to main content
15,921,884 members
Home / Discussions / C#
   

C#

 
AnswerRe: validation Pin
goyal manish23-Feb-06 23:43
goyal manish23-Feb-06 23:43 
QuestionThreadAbortException and SQL? Pin
Kuira23-Feb-06 16:54
Kuira23-Feb-06 16:54 
AnswerRe: ThreadAbortException and SQL? Pin
S. Senthil Kumar23-Feb-06 17:35
S. Senthil Kumar23-Feb-06 17:35 
AnswerRe: ThreadAbortException and SQL? Pin
Le centriste23-Feb-06 18:30
Le centriste23-Feb-06 18:30 
GeneralRe: ThreadAbortException and SQL? Pin
Kuira9-Mar-06 15:59
Kuira9-Mar-06 15:59 
QuestionBindingsource & Tableadapters Pin
monrobot1323-Feb-06 16:35
monrobot1323-Feb-06 16:35 
QuestionLock a document Pin
Lilupa23-Feb-06 16:20
Lilupa23-Feb-06 16:20 
QuestionDataGird Can U help Me Pin
AnhTin23-Feb-06 16:02
AnhTin23-Feb-06 16:02 
AnswerRe: DataGird Can U help Me Pin
Praveen Nayak23-Feb-06 17:14
Praveen Nayak23-Feb-06 17:14 
GeneralRe: DataGird Can U help Me Pin
AnhTin23-Feb-06 18:57
AnhTin23-Feb-06 18:57 
GeneralRe: DataGird Can U help Me Pin
Praveen Nayak23-Feb-06 19:18
Praveen Nayak23-Feb-06 19:18 
GeneralRe: DataGird Can U help Me Pin
AnhTin23-Feb-06 20:23
AnhTin23-Feb-06 20:23 
GeneralRe: DataGird Can U help Me Pin
Maqsood Ahmed23-Feb-06 22:34
Maqsood Ahmed23-Feb-06 22:34 
Questionretrieving the installion path during installion wizard Pin
2hdass23-Feb-06 13:26
2hdass23-Feb-06 13:26 
AnswerRe: retrieving the installion path during installion wizard Pin
veeru_syd27-Feb-06 12:44
veeru_syd27-Feb-06 12:44 
QuestionHandle Word prompts during Automation Pin
Guinness4Strength23-Feb-06 12:30
Guinness4Strength23-Feb-06 12:30 
Questiontyped dataset Pin
fmardani23-Feb-06 11:02
fmardani23-Feb-06 11:02 
QuestionListBox Invalidate issue Pin
Clarke7623-Feb-06 9:24
Clarke7623-Feb-06 9:24 
I have a listbox inwhich all items in that control are check every 30mins. If during that period time it finds an error, that same timer causes the text in the listbox to blink. The issue I'm having is, that this color change is going on every second and causing a blinking on the control. Now I've read articles on double buffering to fix this issue, but have yet to find a single one that works. The best I've gotten it was that one item, other than the item(s) that are supose to blink, will blink every second which isn't as bad as all items but is very very annoying. Here is the code....any ideas?

This is how I draw the text:
<br />
private void listBox1_DrawItem(object sender, DrawItemEventArgs e)<br />
		{<br />
			e.DrawBackground(); <br />
			e.DrawFocusRectangle();<br />
			if( listBox1.Items[ e.Index ] is Server )<br />
			{<br />
				Server server = (Server)listBox1.Items[e.Index];<br />
<br />
				if( server.Error )<br />
				{<br />
					if( blinking )<br />
						e.Graphics.DrawString( listBox1.Items[e.Index].ToString(), myFont, Brushes.Red,<br />
							new Point(e.Bounds.X,e.Bounds.Y));<br />
					else<br />
						e.Graphics.DrawString( listBox1.Items[e.Index].ToString(), myFont, Brushes.Black,<br />
							new Point(e.Bounds.X,e.Bounds.Y));<br />
				}<br />
				else<br />
					e.Graphics.DrawString( listBox1.Items[e.Index].ToString(), myFont, Brushes.Black,<br />
						new Point(e.Bounds.X,e.Bounds.Y));<br />
			}<br />
			else				<br />
				e.Graphics.DrawString( listBox1.Items[e.Index].ToString(), myFont, Brushes.Black,<br />
				new Point(e.Bounds.X,e.Bounds.Y));<br />
		}<br />


The timer:
<br />
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)<br />
		{<br />
			timer1.Stop();<br />
			bool blink = false;<br />
			/*if( click % 3600 == 0 || click == 0 )<br />
			{<br />
				foreach( Object item in listBox1.Items )<br />
				{<br />
					if( item is Server )<br />
					{<br />
						Server server = (Server)item;<br />
						Ping ping = new Ping();<br />
						PingInfo info = ping.PingHost( server.Name );					<br />
						server.PingResponse = info.ResponceTime();<br />
						server.TimeOut = info.TimeOut();<br />
<br />
						if( server.PingResponse > 2 || server.TimeOut )<br />
							server.Error = true;<br />
						else<br />
							server.Error = false;<br />
					}<br />
				}<br />
			}*/<br />
			for( int i=0; i<listBox1.Items.Count; i++ )<br />
			{<br />
				if( listBox1.Items[i] is Server )<br />
				{<br />
					Server server =  (Server)listBox1.Items[i];<br />
					if( server.Error )<br />
					{<br />
						if( blinking )<br />
						{<br />
							blinking = false;<br />
						}<br />
						else<br />
							blinking = true;<br />
<br />
						if( !blink )<br />
							blink = true;<br />
						listBox1.Invalidate();<br />
                                                <br />
					}<br />
				}<br />
			}<br />
<br />
			click++;<br />
			timer1.Start();<br />


Control Properties
<br />
this.DrawMode = DrawMode.OwnerDrawFixed;<br />
			this.SetStyle(<br />
				ControlStyles.AllPaintingInWmPaint |<br />
				ControlStyles.DoubleBuffer |<br />
				ControlStyles.Opaque , true );	<br />


Adding ControlStyles.UserPaint causes the control to go completly black.


Any help would be great!
Thanks
QuestionC# key/mouse detection Pin
weizur123-Feb-06 9:11
weizur123-Feb-06 9:11 
AnswerRe: C# key/mouse detection Pin
Robin Panther23-Feb-06 12:21
Robin Panther23-Feb-06 12:21 
GeneralRe: C# key/mouse detection Pin
weizur123-Feb-06 12:44
weizur123-Feb-06 12:44 
GeneralRe: C# key/mouse detection Pin
Allah On Acid23-Feb-06 15:28
Allah On Acid23-Feb-06 15:28 
GeneralRe: C# key/mouse detection Pin
weizur123-Feb-06 20:49
weizur123-Feb-06 20:49 
GeneralRe: C# key/mouse detection Pin
Allah On Acid24-Feb-06 4:24
Allah On Acid24-Feb-06 4:24 
GeneralRe: C# key/mouse detection Pin
Robin Panther23-Feb-06 21:45
Robin Panther23-Feb-06 21:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.