Visual Basic Foro
Programación => Visual Basic 6 => Mensaje iniciado por: Gianni en Marzo 14, 2010, 03:00:18 pm
-
Hi to all and sorry for my English.
I found 2 problems with the use of ListBoxEX:
1) when you use ScrollStyle = UpDownButton and click over a scroll button (up or down)
You can no longer scroll the list.
Only if you use the mouse wheel or if the control loses focus you can scroll again the list.
For reproduce this click over the scroll button before click in the ListBox.
2) when you use ScrollStyle =ScrollBar and you click over the scrollbar arrow,
I see a random selection appear on the list elements.
Also the list is not scrolled properly.
For reproduce add iItem to ListBox using 0 as icon Index for all item
Please, can someone help me solve this problem?
The icons (also Using 32bit icons) are drawed without alpha channel.
How to fix this? how to improve quality of the icons?
Thanks for any help
Regards
Gianni
-
Hi to all and sorry for my English.
I found 2 problems with the use of ListBoxEX:
1) when you use ScrollStyle = UpDownButton and click over a scroll button (up or down)
You can no longer scroll the list.
Only if you use the mouse wheel or if the control loses focus you can scroll again the list.
For reproduce this click over the scroll button before click in the ListBox.
Well Gianni, I see what you mean. To fix that, you must change some code. In first place, you must change the following line:
Private Sub PicScroll_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim PT As POINTAPI
Dim ScrollVelociti As Long
Static IsIn As Boolean 'delete this line.
... After that, you need to add this to the top of the file:....
Dim InProcessMSG As Boolean
Dim mSelectionWidth As Long
Dim IsIn As Boolean 'Add this
...
Now, edit the following function "GetHitTest" ...
If PT.x > AreaItem And PT.x < AreaItem + mSelectionWidth Then
GetHitTest = (PT.y + TopPos) \ mItemHeight
Else
GetHitTest = -1
End If
... Edit that: ...
If PT.x > AreaItem And PT.x < AreaItem + mSelectionWidth Then
If Not IsIn Then
GetHitTest = (PT.y + TopPos) \ mItemHeight
Else
GetHitTest = -1
End If
Else
GetHitTest = -1
End If
... And for last, add this sub: Private Sub PicScroll_Click(Index As Integer)
IsIn = False
Call PicScroll_MouseMove(Index, 0, 0, 0, 0)
End Sub
And well, for me it's fixed. Tell me later if it's working.
2) when you use ScrollStyle =ScrollBar and you click over the scrollbar arrow,
I see a random selection appear on the list elements.
Also the list is not scrolled properly.
For reproduce add iItem to ListBox using 0 as icon Index for all item
I've tryed that, but.. I can't see what you're saying. Sorry.
Regards, cocus
-
Advertencia - mientras estabas escribiendo, una nueva respuesta fue publicada. Probablemente desees revisar tu mensaje.
The alpha on the icons is fixed once you compile and add a manifest to the file, or alternatively you can change the drawing function to see the results in the IDE. About the scrolls, well I'll let LeandroA answer that since im not familiar with the control.
-
Advertencia - mientras estabas escribiendo, una nueva respuesta fue publicada. Probablemente desees revisar tu mensaje.
The alpha on the icons is fixed once you compile and add a manifest to the file, or alternatively you can change the drawing function to see the results in the IDE. About the scrolls, well I'll let LeandroA answer that since im not familiar with the control.
I'm not sure, but I think that the method of loading file and then adding to the image list, provides alpha channel. I'm only thinking on the manifest. He can use your Add Manifest to the VB6.exe, or put a vb6.exe.manifest in the vb6 path.
-
Hi to all and thanks for help me.
Thanks Leandro now the first problem is gone.
For the second problem:
I tried to reproduce the problem using your demo project.
In Form Load modify your code :
'----------------------------------Ejemplo2
With ListBoxEx2
.IconsSize = 48
For i = 0 To 7
.ImageListLoadIconFromFile App.Path & "\Iconos\" & i & ".ico"
Next
.AddItems "Cámara Fotográfica", 0
.AddItems "Celular", 1
.AddItems "Monitor", 2
.AddItems "Juegos", 3
.AddItems "Papelera de reciclaje", 4
.AddItems "Auriculares", 5
.AddItems "BaterÃa", 6
.AddItems "Reloj", 7
.AddItems "Cámara Fotográfica", 0
.AddItems "Celular", 1
.AddItems "Monitor", 2
.AddItems "Juegos", 3
.AddItems "Papelera de reciclaje", 4
.AddItems "Auriculares", 5
.AddItems "BaterÃa", 6
.AddItems "Reloj", 7
.ScrollStyle = ScrollBar
.IconAlign = AlingLeft
.SelectedIndex = 1
End With
With these changes I am having the problem.
For Alpha Channel Icons:
my fault, sorry the manifest was missing.
It's possible add PNG instead of 32bit icons?
Thanks again for Help
-
Hi to all and thanks for help me.
Thanks Leandro now the first problem is gone.
For the second problem:
I tried to reproduce the problem using your demo project.
In Form Load modify your code :
'----------------------------------Ejemplo2
With ListBoxEx2
.IconsSize = 48
For i = 0 To 7
.ImageListLoadIconFromFile App.Path & "\Iconos\" & i & ".ico"
Next
.AddItems "Cámara Fotográfica", 0
.AddItems "Celular", 1
.AddItems "Monitor", 2
.AddItems "Juegos", 3
.AddItems "Papelera de reciclaje", 4
.AddItems "Auriculares", 5
.AddItems "BaterÃa", 6
.AddItems "Reloj", 7
.AddItems "Cámara Fotográfica", 0
.AddItems "Celular", 1
.AddItems "Monitor", 2
.AddItems "Juegos", 3
.AddItems "Papelera de reciclaje", 4
.AddItems "Auriculares", 5
.AddItems "BaterÃa", 6
.AddItems "Reloj", 7
.ScrollStyle = ScrollBar
.IconAlign = AlingLeft
.SelectedIndex = 1
End With
With these changes I am having the problem.
For Alpha Channel Icons:
my fault, sorry the manifest was missing.
It's possible add PNG instead of 32bit icons?
Thanks again for Help
Maybe, but I like to use ICONs with ALPHA CHANNEL and 32bits, exactly the same as PNGs. Anyway, it's possible adapting some code from this project: INSERTAR IMÁGENES PNG EN UN IMAGELIST (Insert png images to ImageList) (http://www.leandroascierto.com.ar/categoria/M%C3%B3dulos/articulo/Png%20en%20un%20ImageList.php) because the ListBox uses ImageList.
Bye
-
Hi to all and sorry for disturb again.
I have found a bug in ListBoxEx - in Sub Sorted.
If you add Items with uppercase letter the "Sub Sorted" sort the items,
but if you add Items with lowercase letter the "Sub Sorted" Fail to sort items.
Try: (fail)
Private Sub Command6_Click()
ListBoxEx2.AddItems "ape", 0
ListBoxEx2.Sorted AcendetOrder
End Sub
If you use "Ape" or "APE" you have Items sorted.
I have modified Sub Sort:
If Item(i).Caption > Item(i + 1).Caption Thenwith
If UCase(Item(i).Caption )> UCase(Item(i + 1).Caption) Thenand this works.
It's correct or there is a better method?
Thanks for any help