Como carregar imagens no ListView


Author
Message
Marcio Valerio Silva
Marcio Valerio Silva
StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)
Group: Forum Members
Posts: 55, Visits: 929
How Do I load images in the Strata Frame ListView Component?

I Tryed:

Private void listView1_RowPopulating(MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs e)

{
MesasBo loBO = new MesasBo();
loBO = e.BusinessObject;
}



But in C# don´t work "loBO = e.BusinessObject" as the documentation method example in VB.

I somebody know how please answer my question.

thanks!

----------------------------------------------------------------------------------

Como carregar imgens no ListView do Strata Frame os dados já sei como fazer mas gostaria de carregar imagens definidas no cadastro.

Eu até tentei o exemplo da documentação conforme acima porém não funcionou no c#.

Se alguém souber como fazer responda-me por favor.


Obrigado!

at,

Marcio Valerio da Silva
Edited 13 Years Ago by Marcio Valerio Silva
Marcio Valerio Silva
Marcio Valerio Silva
StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)
Group: Forum Members
Posts: 55, Visits: 929
Sorry but I Really need this information!

In the Documentation has this sample:

Private Sub ListView1_RowPopulating( _
                ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) _
                Handles ListView1.RowPopulating
               
    '-- Establish locals
    Dim loBO As CustomersBO
   
    '-- Get the reference to the business object
    loBO = e.BusinessObject
    If loBO.cust_gender = 0 Then
        '-- The customer is a male, set the background color to blue
        '   and set the image key to the boy icon
        e.RowBackColor = Drawing.Color.LightBlue
        e.ImageKey = "boy.ico"
    Else
        '-- The customer is a girl, set the background color to pink
        '   and set the image key to the girl icon
        e.RowBackColor = Drawing.Color.Pink
        e.ImageKey = "girl.ico"
    End If
   
    '-- The fourth column has been configured to PopulateThroughEvent
    If loBO.cust_email.Length > 0 Then
        '-- We have an email in the record
        e.Values(3).DisplayValue = loBO.cust_email
    Else
        '-- We don't have an email for this customer
        e.Values(3).DisplayValue = "unavailable"
    End If
End Sub
and I translated to c#:

private void listView1_RowPopulating(MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs e)
{
MesasBo mesas = new MesasBo();
mesas = e.BusinessObject;
}
and I get this error:

Error 10 Cannot implicitly convert type 'MicroFour.StrataFrame.Business.BusinessLayer' to 'M2BusinessObjectLibrary.MesasBo'. An explicit conversion exists (are you missing a cast?) D:\Projetos\Business Enterprise\M2FoodService\Form1.cs 65 24 M2FoodService


I need a quick solution for this problem.



at,

Marcio Valerio da Silva
Edited 13 Years Ago by Marcio Valerio Silva
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You can't have an explicit conversion in C# if you don't have the operator defined.  In this example, the explicit conversion cannot happen between a BusinessLayer and your BO type.  Just cast it:

MesasBo mesas;
mesas = (MesasBo)e.BusinessObject;


Also, don't create a new instance of mesas because you are pushing a reference to that variable.  So you don't want to create an instance of it first, that will just cause a potential memory leak since you didn't dispose of the object.  Though no handlers were created either, so it would most likely have cleaned itself up through the collector.  But this is still not a good way to setup a variable that will have a reference pushed into it.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search