-
Feb 11th, 2017, 04:34 PM
#1
Thread Starter
PowerPoster
LABEL on listview
I dont know if is possible.....
i need to positioning in center of listview a transparent and foreground Label with the caption:"ATTENZIONE!" untill the listview is filled... and then hide the label.
Tks.
-
Feb 11th, 2017, 04:46 PM
#2
Re: LABEL on listview
Not sure if you can do it with a label, but you can a textbox (and you can lock the textbox and make it LOOK like a label).
-
Feb 11th, 2017, 05:30 PM
#3
Hyperactive Member
Re: LABEL on listview
How do you get the textbox transparent?
-
Feb 11th, 2017, 05:41 PM
#4
Re: LABEL on listview
Ah....I SEEEE...so, you are saying OP wants a transparent 'something' with just LETTERS being shown, right?
-
Feb 11th, 2017, 05:50 PM
#5
Re: LABEL on listview
OK, so use a RICHTEXTBOX instead of a label...see this example:
Put a RICHTEXTBOX on a form on top of a listbox...
Code:
Option Explicit
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&
Private Sub Form_Load()
Dim x As Integer
For x = 0 To 10
List1.AddItem (CStr(x))
Next x
Dim result As Long
result = SetWindowLong(RichTextBox1.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)
End Sub
-
Feb 11th, 2017, 06:01 PM
#6
Hyperactive Member
-
Feb 11th, 2017, 07:16 PM
#7
Re: LABEL on listview
This is really what .MousePointer = vbHourglass is for.
-
Feb 12th, 2017, 01:04 AM
#8
Re: LABEL on listview
You can also consider setting the empty markup text:
It requires subclassing; but in the end it's probably the same amount of work if you want to always have it present when the ListView is empty and keep it in alignment after resize.
In a WM_NOTIFY handling routine,
Code:
Case LVN_GETEMPTYMARKUP
Dim nmlvem As NMLVEMPTYMARKUP
Dim sEMText As String
sEMText = "Empty markup text."
CopyMemory ByVal VarPtr(nmlvem), ByVal lParam, LenB(nmlvem)
CopyMemory nmlvem.szMarkup(0), ByVal StrPtr(sEMText), LenB(sEMText)
nmlvem.dwFlags = EMF_CENTERED
CopyMemory ByVal lParam, ByVal VarPtr(nmlvem), LenB(nmlvem)
DoLVNotify = 1
Exit Function
'where
Public Const L_MAX_URL_LENGTH = 2084
Public Const EMF_CENTERED = &H1
Public Type NMLVEMPTYMARKUP
hdr As NMHDR
dwFlags As Long
szMarkup(0 To ((L_MAX_URL_LENGTH * 2) - 1)) As Byte
End Type
-
Feb 12th, 2017, 03:18 AM
#9
Thread Starter
PowerPoster
Re: LABEL on listview
Originally Posted by fafalone
You can also consider setting the empty markup text:
It requires subclassing; but in the end it's probably the same amount of work if you want to always have it present when the ListView is empty and keep it in alignment after resize.
In a WM_NOTIFY handling routine,
Code:
Case LVN_GETEMPTYMARKUP
Dim nmlvem As NMLVEMPTYMARKUP
Dim sEMText As String
sEMText = "Empty markup text."
CopyMemory ByVal VarPtr(nmlvem), ByVal lParam, LenB(nmlvem)
CopyMemory nmlvem.szMarkup(0), ByVal StrPtr(sEMText), LenB(sEMText)
nmlvem.dwFlags = EMF_CENTERED
CopyMemory ByVal lParam, ByVal VarPtr(nmlvem), LenB(nmlvem)
DoLVNotify = 1
Exit Function
'where
Public Const L_MAX_URL_LENGTH = 2084
Public Const EMF_CENTERED = &H1
Public Type NMLVEMPTYMARKUP
hdr As NMHDR
dwFlags As Long
szMarkup(0 To ((L_MAX_URL_LENGTH * 2) - 1)) As Byte
End Type
Exit function...
But where the init of function code?
And how to call it?
-
Feb 12th, 2017, 12:08 PM
#10
Hyperactive Member
Re: LABEL on listview
fafalone expects you to write your own subclass and capture the WM_NOTIFY message
-
Feb 12th, 2017, 11:25 PM
#11
Re: LABEL on listview
Well it's just every ListView-related sample code on every VB6 website all use the same format, so I started from the point that since the sample code what I posted could be inserted into as-is is ubiquitous, nobody would have to write their own anything unless they had never seen a subclassed ListView in their life. Nothing wrong with that being the case it just wasn't my default assumption.
See the Virtual Mode Grouping project in my sig for how to set up subclassing that handles LVN_ messages.
-
Feb 13th, 2017, 04:45 AM
#12
Thread Starter
PowerPoster
Re: LABEL on listview
I'M very sorry... i'm not in VB6 but VBA for excel.
Tks
-
Feb 13th, 2017, 07:46 AM
#13
Re: LABEL on listview
Thread moved from the VB6 forum to the 'Office Development/VBA' forum.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|