GUIListcontrol: centered icon for single Listitem (1 Viewer)

Scrounger

Retired Team Member
  • Premium Supporter
  • January 21, 2009
    1,032
    514
    Stuttgart
    Home Country
    Germany Germany
    Hi,

    for my plugin Clickfinder ProgramGuide, i use diffrent Images with different sizes as Listitem Icons.
    As you can see in the screenshot, i would like to center the icon of the Listcontrol.
    GUI_Items_MP-TvSeries.jpg

    I didn't find something in the Wiki and the forum.

    Is it possible to center the Listcontrol Icon for a single Item?

    My Idea to solve this problem, is to calculate the size and then change the iconoffsets. But i think it's only possible to change the iconoffsets for the whole Listcontrol?

    I am grateful for every suggestion.
     

    Scrounger

    Retired Team Member
  • Premium Supporter
  • January 21, 2009
    1,032
    514
    Stuttgart
    Home Country
    Germany Germany
    Thanks for the advice.
    I still tried this but i didn't get it to work. I use the following function to define the listitem and add them to listcontrol.

    Code:
        Public Shared Sub AddListControlItem(ByVal WindowId As Integer, ByVal Listcontrol As GUIListControl, ByVal idProgram As Integer, ByVal ChannelName As String, ByVal titelLabel As String, Optional ByVal timeLabel As String = "", Optional ByVal infoLabel As String = "", Optional ByVal ImagePath As String = "")
     
            Dim lItem As New GUIListItem
     
            Dim test As New GUIImage(idProgram)
            test.FileName = ImagePath
            test.Centered = True
            test.KeepAspectRatio = True
            test.Size = New MediaPortal.Drawing.Size(Listcontrol.ImageWidth, Listcontrol.ImageHeight)
            test.SetPosition(Listcontrol.IconOffsetX, Listcontrol.IconOffsetY)
     
            lItem.Label = titelLabel
            lItem.Label2 = timeLabel
            lItem.Label3 = infoLabel
            lItem.ItemId = idProgram
            lItem.Path = ChannelName
            lItem.Icon = test
     
            GUIControl.AddListItemControl(WindowId, Listcontrol.GetID, lItem)
     
            'MyLog.Debug("[AddListControlItem]: ImagePath: " & ImagePath)
     
        End Sub

    Can someone please help me with this problem. Or is a plugin out there, with such a function?
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    You forgot test.AllocResources();

    Might be because of that. Also make sure you're not leaking resources, you need to keep references to those GUIImages created and dispose them properly ;)

    I actually had other idea in mind with my previous post and that is to create memory image (bitmap) and load it manually in GUITextureManager. You can then use that string reference to set item IconImage.
     

    Scrounger

    Retired Team Member
  • Premium Supporter
  • January 21, 2009
    1,032
    514
    Stuttgart
    Home Country
    Germany Germany
    Hi SilentException,

    first, thanks for your suggestion. In the last week i tried a lot. Using the guiimage needs to much ressources.

    to create memory image (bitmap) and load it manually in GUITextureManager
    Using the image class to get the images in rigth format is very easy. Also create a memory image and load it into GUITextureManager works.

    that string reference to set item IconImage
    But that's still my problem. Can you give a little a example please.
     

    Users who are viewing this thread

    Top Bottom