 |
|
 |
Hi.
First of all, great work!
I noticed that the backcolor of a listviewitem is ignored when you use a watermark.
For example.
Dim MyItem as new listviewitem("Some text")
MyItem.backcolor = color.Blue
MyListview.Items.add(MyItem)
Mylisview.Watermark = MyImage
Any solutions to this?
Thanks.
Erik.
|
|
|
|
 |
|
 |
I remember reading somewhere that when using the Watermark Code, that the item's backcolor property is either ignored or overridden.
It is automatically set to transparent or something. I haven't really looked into it yet. There may be a way to circumvent this through owner drawing. I'll play around with it later, I've got a busy week ahead of me. If I come up with something, I'll let you know.
CLWPROGRAMMER
|
|
|
|
 |
|
 |
I need this type of functionality badly! Thanks for this
|
|
|
|
 |
|
 |
Hi,
The watermark doesn't work on a computer with Windows server 2003 R2.
Why?
Thanks.
|
|
|
|
 |
|
 |
Not sure, I don't have a computer with windows server 2003 R2 to test it on.
CLWPROGRAMMER
|
|
|
|
 |
|
 |
Does anyone know of any way to do somethings similar for a multiline textbox?
Not necessarily using P-Invoke
The watermark must be semi-transparent so it doesn't disturb the eye too much.
TIA,
Johnny J.
|
|
|
|
 |
|
 |
I wanted to let everyone know that I am working on an update. It may take a bit, because I work 8-10 hrs a day and off 2. Some plans are: renaming of some properties(watermarkimage to backgroundimage, WatermarkAlpha to BackgroundImageTransparency), adding some properties(BackgroundImageLayout{None,Stretch,Zoom...}, BackgroundImagePosition{TopLeft,TopCenter,TopRight,...}), Gonna try to fix the item background problem when setting a backgroundimage(microsoft automatically paints item's background color as transparent no matter which backgroundimage setting you use). That's all I can think of at the moment. I won't be updating the article until I get something more concrete to work with. Thanks for your patience.
CLWPROGRAMMER
|
|
|
|
 |
|
 |
good find but why not just add code to the article so I can read what you did, also since you said you took a long time in finding out how to do it why don't you say what the issues were in the article.
cheers,
Donsw
My Recent Article : Backup of Data files - Full and Incremental
|
|
|
|
 |
|
 |
respect, dude ...
Thanks for sharing. Just what I was looking for.
Any idea how to mak it centered in the listview?
And zooming i.s.o. static size?
Regards ...
... Dennis
|
|
|
|
 |
|
 |
This link may help you to get what you need.
http://msdn.microsoft.com/en-us/library/bb774742(VS.85).aspx[^]
the way microsoft's article reads, you have to use lvbkif_style_normal in the ulFlag to be able to move the background image to center, I don't think you can use lvbkif_type_watermark along with lvbkif_style_normal and have the background image to stay stationary. I may be wrong, because I haven't messed around with the other settings for the ulFlag property. I was only trying to get the watermark in the lower right corner to work. I will work on the control a little more to see what I can come up with. Maybe another added property to set the background style and position.
I may be showing my dumb streak, but I'm not too sure what you mean by 'zooming i.s.o static size'.
After all, I'm a self learner. I don't exactly have the time for school at the moment. I just mess around with programming on my free time.
CLWPROGRAMMER
|
|
|
|
 |
|
 |
Thanks for the quick reply!
If I can find some extra time, I will also play with some of the setting and publish my findings here.
>> I'm not too sure what you mean by 'zooming i.s.o static size'
I mean that the watermark image can grow and shrink with the control
Greetz ...
... Dennis
|
|
|
|
 |
|
 |
>>image can grow and shrink with the control
in the extended control's code, edit the getbmp code to redraw the image to the size you want.
because that's really what I do to get the alphablended effect.
CLWPROGRAMMER
|
|
|
|
 |
|
 |
The following is the GetBMP Function currently in the zipped code.
Private Function GetBMP(ByVal FromImage As Image) As IntPtr
Dim bmp As Bitmap = New Bitmap(FromImage.Width, FromImage.Height)
Dim g As Graphics = Graphics.FromImage(bmp)
g.Clear(Me.BackColor)
g.DrawImage(FromImage, 0, 0, bmp.Width, bmp.Height)
g.FillRectangle(New SolidBrush(Color.FromArgb(WatermarkAlpha, Me.BackColor.R, Me.BackColor.G, Me.BackColor.B)), New RectangleF(0, 0, bmp.Width, bmp.Height))
g.Dispose()
Return bmp.GetHbitmap
bmp.Dispose
End Function
The above will need to be changed to the following, just to make sure the temporary bitmap gets destroyed:
Private Function GetBMP(ByVal FromImage As Image) As IntPtr
Dim bmp As Bitmap = New Bitmap(FromImage.Width, FromImage.Height)
Dim g As Graphics = Graphics.FromImage(bmp)
g.Clear(Me.BackColor)
g.DrawImage(FromImage, 0, 0, bmp.Width, bmp.Height)
g.FillRectangle(New SolidBrush(Color.FromArgb(WatermarkAlpha, Me.BackColor.R, Me.BackColor.G, Me.BackColor.B)), New RectangleF(0, 0, bmp.Width, bmp.Height))
g.Dispose()
Dim hBM as IntPtr = bmp.GetHbitmap
bmp.Dispose
Return hBM
End Function
CLWPROGRAMMER
|
|
|
|
 |
|
 |
thank you for the information on the bmp.dispose. I had saw people using the keyword 'Using' in c# but had never seen it being used in vb.NET. I as a self-learner, meaning I have never been to school for this stuff, and learn by examples. Again, Thank You.
CLWPROGRAMMER
|
|
|
|
 |
|
 |
Hi
thx for sharing! I always wanted to know how this is done.
One thing: In GetBMP the bmp.Dispose is afaik not called. The return statement prevents this. I added two using statements.
Private Function GetBMP(ByVal FromImage As Image) As IntPtr
Using bmp = New Bitmap(FromImage.Width, FromImage.Height)
Using g As Graphics = Graphics.FromImage(bmp)
...
End Using
Return bmp.GetHbitmap
End Using
End Function
have a great day
Daniel
|
|
|
|
 |
|
 |
Daniel,
You are incorrect. The using pattern creates a try..finally block that is functionally the same as the following code
Try
...
End Try
Finally
bmp.Dispose()
End Finally
Even with a return statement the CLR will ensure that the Finally block is called.
|
|
|
|
 |