Click here to Skip to main content
15,902,447 members
Home / Discussions / C#
   

C#

 
QuestionRe: Using Regex in C# for ip:port format Pin
Roink2-Dec-08 3:45
professionalRoink2-Dec-08 3:45 
AnswerRe: Using Regex in C# for ip:port format Pin
J4amieC2-Dec-08 5:10
J4amieC2-Dec-08 5:10 
GeneralRe: Using Regex in C# for ip:port format Pin
Roink2-Dec-08 5:24
professionalRoink2-Dec-08 5:24 
GeneralRe: Using Regex in C# for ip:port format Pin
J4amieC2-Dec-08 5:49
J4amieC2-Dec-08 5:49 
GeneralRe: Using Regex in C# for ip:port format Pin
PIEBALDconsult2-Dec-08 9:30
mvePIEBALDconsult2-Dec-08 9:30 
AnswerRe: Using Regex in C# for ip:port format [modified] Pin
Andy Rama2-Dec-08 22:39
Andy Rama2-Dec-08 22:39 
QuestionQuestion about ListView Pin
Teuz2-Dec-08 1:30
Teuz2-Dec-08 1:30 
AnswerRe: Question about ListView Pin
Simon P Stevens2-Dec-08 1:39
Simon P Stevens2-Dec-08 1:39 
You can modify the list view by making is partially owner drawn.

You set the OwnerDraw property on the list view to true, then handle the various Draw events.
listView1.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(listView1_DrawColumnHeader);
listView1.DrawItem += new DrawListViewItemEventHandler(listView1_DrawItem);
listView1.DrawSubItem += new DrawListViewSubItemEventHandler(listView1_DrawSubItem);

// Draw sub item event handler
void listView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
{
    e.DrawDefault = true;
}

// Draw item event handler
void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
    /* PUT YOUR CODE HERE */
    //e.Graphics...Draw stuff
    //e.Graphics...Draw stuff

    e.DrawDefault = true;
}

// Draw header event handler
void listView1_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
{
    e.DrawDefault = true;
}
The events are triggered each time that part of the list view needs redrawing, and you just draw what ever you want onto the graphics object provided. You can call handy methods on the event args object like DrawText() to do the text drawing for you. Then all you do is leave out the focus rectangle, and if required, draw your own focus rectangle in the style you want.

You will need to check e.Item.Selected to see if the item being drawn is selected and if it needs a focus rectangle drawing or not.

Simon

GeneralRe: Question about ListView Pin
Teuz2-Dec-08 1:59
Teuz2-Dec-08 1:59 
GeneralRe: Question about ListView Pin
Simon P Stevens2-Dec-08 2:44
Simon P Stevens2-Dec-08 2:44 
Questioncopy protection Pin
Prashant B. Lavate2-Dec-08 1:12
Prashant B. Lavate2-Dec-08 1:12 
AnswerRe: copy protection Pin
Simon P Stevens2-Dec-08 1:49
Simon P Stevens2-Dec-08 1:49 
AnswerRe: copy protection Pin
Giorgi Dalakishvili2-Dec-08 1:56
mentorGiorgi Dalakishvili2-Dec-08 1:56 
GeneralRe: copy protection Pin
leppie2-Dec-08 2:05
leppie2-Dec-08 2:05 
GeneralRe: copy protection Pin
Paul Conrad2-Dec-08 5:01
professionalPaul Conrad2-Dec-08 5:01 
GeneralRe: copy protection Pin
Dan Neely2-Dec-08 5:31
Dan Neely2-Dec-08 5:31 
GeneralRe: copy protection Pin
Paul Conrad2-Dec-08 5:36
professionalPaul Conrad2-Dec-08 5:36 
GeneralRe: copy protection Pin
Dan Neely2-Dec-08 5:46
Dan Neely2-Dec-08 5:46 
GeneralRe: copy protection Pin
Paul Conrad2-Dec-08 5:51
professionalPaul Conrad2-Dec-08 5:51 
GeneralRe: copy protection Pin
Samer Aburabie2-Dec-08 10:41
Samer Aburabie2-Dec-08 10:41 
GeneralRe: copy protection Pin
Paul Conrad2-Dec-08 10:45
professionalPaul Conrad2-Dec-08 10:45 
GeneralRe: copy protection Pin
Samer Aburabie2-Dec-08 11:16
Samer Aburabie2-Dec-08 11:16 
QuestionReliable Logging Pin
blackjack21502-Dec-08 1:06
blackjack21502-Dec-08 1:06 
AnswerRe: Reliable Logging Pin
SeMartens2-Dec-08 1:13
SeMartens2-Dec-08 1:13 
GeneralRe: Reliable Logging Pin
Samer Aburabie2-Dec-08 10:46
Samer Aburabie2-Dec-08 10:46 

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.