Click here to Skip to main content
15,887,350 members
Home / Discussions / C#
   

C#

 
AnswerRe: My tables hate me Pin
Colin Angus Mackay28-Sep-07 5:19
Colin Angus Mackay28-Sep-07 5:19 
GeneralRe: My tables hate me Pin
BoneSoft28-Sep-07 5:22
BoneSoft28-Sep-07 5:22 
GeneralRe: My tables hate me Pin
ESTAN28-Sep-07 9:42
ESTAN28-Sep-07 9:42 
GeneralRe: My tables hate me Pin
Colin Angus Mackay28-Sep-07 10:08
Colin Angus Mackay28-Sep-07 10:08 
GeneralRe: My tables hate me Pin
Evan St. John2-Oct-07 6:51
Evan St. John2-Oct-07 6:51 
AnswerRe: My tables hate me Pin
rowdykuttan28-Sep-07 5:26
rowdykuttan28-Sep-07 5:26 
GeneralRe: My tables hate me Pin
Evan St. John28-Sep-07 5:36
Evan St. John28-Sep-07 5:36 
QuestionCustom Drawing of list Items Background Pin
Sukhjinder_K28-Sep-07 3:19
Sukhjinder_K28-Sep-07 3:19 
I want to Draw a Custom Background for the selected Item
Here is what I've tried
<br />
MyListBox()	//Constructor<br />
{<br />
<br />
	this.SetStyle(ControlStyles.DoubleBuffer, true);<br />
	this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);<br />
	<br />
	base.DrawMode = DrawMode.OwnerDrawVariable;<br />
			<br />
	this.DrawItem += new DrawItemEventHandler(this.DrawItemHandler);	<br />
	this.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.MeasureItemHandler);<br />
}<br />
private void MeasureItemHandler(object sender, MeasureItemEventArgs e)<br />
{<br />
	e.ItemHeight = (int)(e.Graphics.MeasureString(this.Items[e.Index].ToString(), this.Font).Height);<br />
}<br />
private void DrawItemHandler(object sender, DrawItemEventArgs e)<br />
{<br />
	e.Graphics.SmoothingMode = SmoothingMode.HighQuality;<br />
<br />
	if( e.Index == this.SelectedIndex)<br />
		DrawItemBackground(e.Graphics, e.Bounds, Color.Peru);		// Paint Selected Item in Peru<br />
	else<br />
		DrawItemBackground(e.Graphics, e.Bounds, Color.Pink);		// All Others in Pink<br />
	<br />
	e.Graphics.DrawString(this.Items[e.Index].ToString(), this.Font, this.writeBrush, e.Bounds);	<br />
}<br />

Now, Everything shows up correctly initially but as I continue changing the selected Item the newer ones get painted properly but the old ones are not repainted. So all the items which are selected by me get painted in Peru. What I want is that only the one which the user selects gets its background painted in Peru and others Pink (repainted as non selected Items).

So Please Advice what am I missing.

Thanks...
AnswerRe: Custom Drawing of list Items Background Pin
TJoe28-Sep-07 6:19
TJoe28-Sep-07 6:19 
GeneralIt Works Pin
Sukhjinder_K28-Sep-07 6:31
Sukhjinder_K28-Sep-07 6:31 
QuestionActive Directory Pin
Justin Perez28-Sep-07 2:54
Justin Perez28-Sep-07 2:54 
AnswerRe: Active Directory Pin
Justin Perez28-Sep-07 3:52
Justin Perez28-Sep-07 3:52 
QuestionChange IP Address of an IP Packet Pin
naezl28-Sep-07 2:02
naezl28-Sep-07 2:02 
AnswerRe: Change IP Address of an IP Packet Pin
Colin Angus Mackay28-Sep-07 3:14
Colin Angus Mackay28-Sep-07 3:14 
QuestionMy customer should dot net framework be installed on his device to open and use my application? Pin
Yasser Abu Elmakarem28-Sep-07 2:01
Yasser Abu Elmakarem28-Sep-07 2:01 
AnswerRe: My customer should dot net framework be installed on his device to open and use my application? Pin
Pete O'Hanlon28-Sep-07 2:11
mvePete O'Hanlon28-Sep-07 2:11 
AnswerRe: My customer should dot net framework be installed on his device to open and use my application? Pin
Dan Neely28-Sep-07 2:11
Dan Neely28-Sep-07 2:11 
GeneralRe: My customer should dot net framework be installed on his device to open and use my application? Pin
Vasudevan Deepak Kumar28-Sep-07 2:21
Vasudevan Deepak Kumar28-Sep-07 2:21 
GeneralRe: My customer should dot net framework be installed on his device to open and use my application? Pin
Dan Neely28-Sep-07 2:40
Dan Neely28-Sep-07 2:40 
QuestionRecord in Txt Pin
Can_8528-Sep-07 1:56
Can_8528-Sep-07 1:56 
AnswerRe: Record in Txt Pin
Colin Angus Mackay28-Sep-07 2:00
Colin Angus Mackay28-Sep-07 2:00 
QuestionREFRESH the database after updating Pin
prasadbuddhika28-Sep-07 1:50
prasadbuddhika28-Sep-07 1:50 
AnswerRe: REFRESH the database after updating Pin
Malcolm Smart28-Sep-07 2:38
Malcolm Smart28-Sep-07 2:38 
QuestionProblem with font and GDI+ Pin
Bin2Hex28-Sep-07 1:39
Bin2Hex28-Sep-07 1:39 
Questioninserting control into DataGridView rows Pin
half-life28-Sep-07 1:22
half-life28-Sep-07 1:22 

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.