Page 2 of 2 FirstFirst 12
Results 41 to 69 of 69

Thread: [2008] Get part of background image covered by ListView control

  1. #41

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    I've managed to eliminate a huge part of the flicker, there is hardly any left now... The contol is shaping up nicely, however the Owner drawing is presenting some issues which were taken care of when the ListView was not Owner drawn...

    The following thread presents a particularly nasty problem I've encountered:

    http://www.vbforums.com/showthread.php?t=558822

    Any help would be greatly appreciated. I'm looking forward to finishing this control and posting it in the CodeBank - that would be a first for me
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  2. #42

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    @kleinma:
    First of all, I'd like to thank you for all your help so far.

    I'm using one of your translucent tab controls from the links you provided, however I'm encountering some issues. See the following screenshot:
    Name:  Capture.JPG
Views: 891
Size:  102.0 KB
    When I first put the picture as a background, the left side was offset by 200 pixels :S I played with the offset values to get to this result, however, notice that the image is not scaled properly: although the segments match on the left side, there are noticeable differences in the middle and on the right side. Could you please help me out?

    One more thing. Is there any way I can make the translucent tab control work with other layouts except Stretch?

    In case you're wondering, that control in the middle of the picture is the TransparentListView I'm working on at the moment. There is no flicker left and I'm trying to sort out the mouse click issues I wrote about in my other post.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  3. #43
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    My first guess is it could have something to do with that horizontal scrollbar. Do things line up when it is not visible?

  4. #44

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    I think you might have misunderstood me. The TransparentListView is simply showing the picture behind it (it is truly transparent, the effect is not achieved by copying the background). The picture is offset on the TranslucentTabControl. It seems to me that the scaling might be off. The picture in the background is a 2MP photo I took with my cellphone.

    Name:  Capture.jpg
Views: 813
Size:  105.9 KB
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  5. #45
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    can you attach that image?

  6. #46

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    Sure thing.
    Attached Images Attached Images  
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  7. #47
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    I don't have your listview control to test, but when I take that image, and use it as the background on a form, and use my translucent tab control on it, with offset of 0,0, it looks to match up ok to me.

  8. #48

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    I just had one more look at the code. I'm sorry for not mentioning this earlier, but I just saw that I had actually made a minor modification in the code due to an application requirement. The translucent tab control is actually located on a split container, located on a panel control and takes the panel's background instead of the form's background.

    In other words, it takes the background of its container's container (2 levels up) instead of its own container (1 level up).

    This is the only change I've made in the painting code:
    vb.net Code:
    1. 'GET THE CONTROL THAT THE IMAGE IS ON WE WANT TO USE FOR TRANSLUCENCY
    2.         Dim parentControl As Control = Nothing
    3.         Select Case _backgroundImageSource
    4.             Case ITranslucentControl.eBackgroundImageSource.Form
    5.                 'GET FORM
    6.                 parentControl = Me.FindForm
    7.             Case ITranslucentControl.eBackgroundImageSource.Container
    8.                 'GET PARENT (WILL BE FORM IF NO CONTAINER EXISTS)
    9.                 parentControl = Me.Parent
    10.             Case ITranslucentControl.eBackgroundImageSource.Custom
    11.                 parentControl = _customParent
    12.         End Select

    Could this be the source of the problem?

    Once again, sorry for not writing this sooner and thanks for your help.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  9. #49
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    just so I have it right, the parent ordering is something like this?

    form -> panel -> split container -> splitcontainerpanel -> tab control

    right?

  10. #50

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    Exactly.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  11. #51
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    is the panel on the form docked to full

  12. #52

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    The form has a toolbar in the top section (some 48px or so), the rest is occupied by the panel.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  13. #53
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    so then what are you doing specifically that makes the splitcontainer transparent to the panel it is sitting on? Did you implement some extra?

    Because with my code, if you had form -> panel (has image on it) -> split container -> split container panel -> tabcontrol

    then I don't see how the image comes through in the split container, since that would cover the panel. Are you custom drawing the panels in the split container as well?

  14. #54

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    No, since the panel control supports ARGB colors, I simply set its background color to transparent (0, 0, 0, 0).
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  15. #55
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    ah.. my bad.. i see you need to set the split container panels transparent AND the underlying split panel container control as well.

    I will test now and see if I can solve your issue.

  16. #56

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    Thank you
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  17. #57
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    I tried this and had what I think are accurate results:

    Set your image as the background of the form (not the panel like I think you are doing right now) of course set the imagelayout to stretch.

    Then I added a panel, and set its dock to fill. I set its backcolor to transparent, so the image shows through

    I then added a split container, which auto dock fills the panel, and automatically is transparent, so the forms image comes through this control as well.

    Then I added my translucent tab control, and set its IsTranslucent to true.

    The results look to match up fine for me. I don't have any offset problems.

    I also added a menustrip to the form as an additional test.

  18. #58

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    Unfortunately, I'm using a ribbon and not a menustrip The ribbon covers a huge portion of the background image of the form, so I wanted to combat that effect by setting the image to the panel instead of the form itself. Is there no other way?
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  19. #59
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    man stop changing the specs on me

    I'm sure there is another way, I just didn't look past my initial solution because I didn't know you COULDN'T use the form. I just thought you weren't using the form.

    You probably won't hear from me until tomorrow though, because I am heading home in a minute for the day.

  20. #60

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    I'm sorry for not being clear... I appreciate your help.

    Have a nice day
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  21. #61

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    Any updates?
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  22. #62
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    Sorry, I haven't had much time to work on it. It has something to do with the nested nature of the controls, and the fact that you are putting it in the right side panel of the split container. The good news is, there is a solution, I just haven't had time to iron it out.

    You can see that if you have the control on the left side panel of the split container, it does line up correctly. It is the left one (being offset by a container) that is still off (it's actually grabbing the same image, since it is not calculating an offset for the split container). The solution isn't just to offset for the left panel, it should be something more universal to the problem.
    Attached Images Attached Images  

  23. #63

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    Thank you for all your help so far. I don't mean to be rude or ungrateful, but the deadline for this project is Monday morning (1 week from now) and it would be awesome if you could provide an effective solution before that date. If not, I guess I'll just have to stick with the manual offset tweaks...
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  24. #64
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    I hear ya.. I am sure we could come up with a workable solution for just the given scenario, but how will that play out on something like a split container that is split horizontally. I just figure make the offset work no matter what the case is.

  25. #65

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    I'll leave the matter in your capable hands then Thanks again
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  26. #66
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    Obi..I think I have this solved.

    It did require adding the 3rd option like you did to set a custom background source. Once that was done, I had to code a loop to calculate the x/y coordinates of the control in relation to n levels down of parents to get to the control that is assigned as the CustomContainer.

    So you may also want to add some error handling to the setter of the CustomContainer to ensure that when someone sets that property, they are only allowed to set it to a control that is actually a container to the control you are making transparent. Otherwise it will likely hit an infinite loop when trying to calculate the x/y (since it loops back each parent until the one you specified is hit)

    Anyway, here is a test project with the modified code in it, and you can see I tried both vertical and horizontal split containers on top of panels with the bg image, and it looks to me to be working fine.
    Attached Files Attached Files

  27. #67

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    When I set a very small image stretched over the panel (the image was 7x7 pixels, created in Paint), the colors are a little off, other than that it works like a charm Since I won't be using such a small image, the modifications are perfect for me

    Thanks a lot. Your help is much appreciated. Unfortunately, the forum states that I'm supposed to spread some rep around before giving it to you again :S
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  28. #68
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2008] Get part of background image covered by ListView control

    I'm just glad it is working for you.

    Colors could be off on a 7x7 pixel image just due to the stretching... anything of a larger acceptible size should work just fine.

  29. #69

    Thread Starter
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Get part of background image covered by ListView control

    I finally finished the control and posted it in the CodeBank:
    http://www.vbforums.com/showthread.p...93#post3693493

    Kleinma, thank you for all your help It was a pleasure

    Cheers
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

Page 2 of 2 FirstFirst 12

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