Results 1 to 8 of 8

Thread: Kill Focus Rectangle!

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Post Kill Focus Rectangle!

    I have 4 images (with text) in a ListView. When 1 of the images is selected, not only the text accompanying that image gets highlighted even the image gets highlighted. Now I want only the text to be highlighted, not the image. How do I do it?

    I came across this article in VBForums which makes use of 2 CommandButtons to kill the focus rectangle. Since I am not using a CommandButton, I am putting the only line (in that code) in the Command1_Click event function in my ListView1_Click event function but when I run it, VB crashes.

    Thanks,

    Arpan

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Kill Focus Rectangle!

    I don't know if this is what you want, but here goes...

    Set the ListView's LabelEdit property to lvwManual

    In the ListView MouseUp event do "ListView1.StartLabelEdit"
    This world is not my home. I'm just passing through.

  3. #3

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: Kill Focus Rectangle!

    But I don't want to give users the option to edit the labels associated with the images.

    Arpan

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Kill Focus Rectangle!

    Why do you want to do that for? It will not look very consistent with other applications if only the text gets highlighted.

  5. #5

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: Kill Focus Rectangle!

    Why do you want to do that for? It will not look very consistent with other applications if only the text gets highlighted.
    That's alltogether a different aspect, my dear penagate

    Arpan

  6. #6
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Re: Kill Focus Rectangle!

    I fully agree with Penagate.

    However, if you insist then add this. It's still somewhat less than optimal, but that's what you get if you want to go non-standard...


    VB Code:
    1. Private Sub ListView1_AfterLabelEdit(Cancel As Integer, NewString As String)
    2.   Cancel = True
    3. End Sub
    This world is not my home. I'm just passing through.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Kill Focus Rectangle!

    Ahhh...

    You could use the _ItemClick event, which fires when an item is selected, and blit the icon image from the ImageList onto the ListView's DC - that should overwrite the "highlighted" image.

    If you need any assistance with that I might be able to construct a quick example, that's assuming it works

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Kill Focus Rectangle!

    Here you go - subclassing and BitBlt'ing wrapped into a module - tested and working.

    HTH
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width