Home > Software engineering >  VB listview insert pictures in a column in a line, how do you write the code?
VB listview insert pictures in a column in a line, how do you write the code?

Time:09-25

Such as topic, in order to realize the function of is, if send gifts, and insert a picture on the corresponding form, and request all code oh,,, thank you master,,, wondered for a long time,
The diagram below:

CodePudding user response:

Insert pictures first must have a need to insert pictures, generally USES the icon, is ICO extension icon, the icon should be placed Imagelist control, need to call the ICONS in the Imagelist control,
Wait a moment, I give you a way,

CodePudding user response:

reference 1st floor u013249970 response:
insert first must have a need to insert the pictures, generally USES the icon, is the ICO extensions of the icon, the icon should be placed Imagelist control, when need to call the ICONS in the Imagelist control,
Wait a moment, I give you do a appearance,

Warrior, if in the first column, insert the picture, I know how to do it, but now I asked in the second column, insert a ICO icon, I just don't come out, could you please help solve it, thanks.

CodePudding user response:

Help warrior,,,, genuflect is begged,,

CodePudding user response:

Warrior person??????????

CodePudding user response:

The ListView control itself does not have such functions,

You have to embedded Image element,

At ordinary times, the use of the Visible attribute these hidden Image, displayed, when need

More trouble is, if there is a scroll bar, to write code to make these pictures follow synchronous movement,

CodePudding user response:

'Set mitmX=LVW. ListItems. Add (1, [this keyword], [display characters], and [keyword] images)

Which picture keywords related to imagelist
To add images in imagelist (picture)

CodePudding user response:

Simple said once:
Use the Picture property of the listview control; Need to lock the header (ban with the mouse to adjust the column width),

Effect would be very ideal,

CodePudding user response:

My plan don't need to consider the ListView display content "rolling" problem, it will "synchronization",

CodePudding user response:

Listview in a certain line insert pictures in the column, in the second line of your insert, it seems more difficult, and only language sentence, it cannot be estimated, other methods must be used to achieve the purpose of you, I used the Image1 image control group, and then used the Frame1 container control, meet your requirements, the following figure: , the design of interface as shown in figure:  , which bring some is Frame1 container control, code is as follows:
 Private Sub Form_Load () 
Image1 (0). The Visible=False
Dim As ColumnHeader c
Dim itmx As ListItem
ListView1. ColumnHeaders. Add, and "micro r/number," ListView1. Width/2
ListView1. ColumnHeaders. Add, and "gift", ListView1. Width/4, lvwColumnCenter
ListView1. ColumnHeaders. Add,, "state", ListView1. Width/4
ListView1. Checkboxes=True
ListView1. View=lvwReport
ListView1. ForeColor=& amp; HFF
ListView1. The Font. Bold=True
For I=1 To 6
The Set itmx=ListView1. ListItems. Add (,, CStr (I + 11072))
LL=120
WW=260 * (I - 1)
If I Mod 2=0 Then
Itmx. SubItems (2)="buy"
The Else
Itmx. SubItems (2)="pending"
End the If
If itmx. SubItems (2)="buy" Then
The Load Image1 (I) : Image1 (I). The Visible=True: Image1 (I). The Left=LL: Image1 (I). The Top=WW
Image1 (I). The Picture=LoadPicture (App) Path & amp; "\ 100. Ico")
The Else
The Load Image1 (I) : Image1 (I). The Visible=True: Image1 (I). The Left=LL: Image1 (I). The Top=WW
Image1 (I). The Picture=LoadPicture (App) Path & amp; "\ 101. Ico")
End the If
Next I
End Sub
no matter how to implement, it is ok to achieve a goal, I do not know can help you!
  • Related