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:
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:
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
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.
Please rate helpful ppl's posts. It's the best 'thank you' you can give
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.
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:
'GET THE CONTROL THAT THE IMAGE IS ON WE WANT TO USE FOR TRANSLUCENCY
Dim parentControl As Control = Nothing
Select Case _backgroundImageSource
Case ITranslucentControl.eBackgroundImageSource.Form
'GET FORM
parentControl = Me.FindForm
Case ITranslucentControl.eBackgroundImageSource.Container
'GET PARENT (WILL BE FORM IF NO CONTAINER EXISTS)
parentControl = Me.Parent
Case ITranslucentControl.eBackgroundImageSource.Custom
parentControl = _customParent
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
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?
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.
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
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.
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.
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
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.
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.
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