Objectlistview从c到vb.net的转换

Objectlistview从c到vb.net的转换,vb.net,objectlistview,Vb.net,Objectlistview,我需要一些关于vb.net中objectlistview的帮助,我确实将所有内容从c转换到vb.net,并将BrightIdeasSoftware导入vb.net,所有设置和配置与c相同,但只有图像+标题+说明不起作用,只有带有小图标的进度。objectlistview与c语言相同,每种语言都相同imageListLarge、imageListSmall。从示例来看,c运行得很好,我在转换代码时是否做错了什么 我需要一些专业的触摸和帮助 谢谢 下面是vb.net的转换程序 Public

我需要一些关于vb.net中objectlistview的帮助,我确实将所有内容从c转换到vb.net,并将BrightIdeasSoftware导入vb.net,所有设置和配置与c相同,但只有图像+标题+说明不起作用,只有带有小图标的进度。objectlistview与c语言相同,每种语言都相同imageListLarge、imageListSmall。从示例来看,c运行得很好,我在转换代码时是否做错了什么

我需要一些专业的触摸和帮助 谢谢

下面是vb.net的转换程序

    Public Class NamedDescriptionDecoration
        Inherits BrightIdeasSoftware.AbstractDecoration
        Public ImageList As ImageList
        Public ImageName As String
        Public Title As String
        Public Description As String

        Public TitleFont As New Font("Tahoma", 9, FontStyle.Bold)
        Public TitleColor As Color = Color.FromArgb(255, 32, 32, 32)
        Public DescripionFont As New Font("Tahoma", 9)
        Public DescriptionColor As Color = Color.FromArgb(255, 96, 96, 96)
        Public CellPadding As New Size(1, 1)

        Public Overrides Sub Draw(olv As BrightIdeasSoftware.ObjectListView, g As Graphics, r As Rectangle)
            Dim cellBounds As Rectangle = Me.CellBounds
            cellBounds.Inflate(-Me.CellPadding.Width, -Me.CellPadding.Height)
            Dim textBounds As Rectangle = cellBounds

            If Me.ImageList IsNot Nothing AndAlso Not [String].IsNullOrEmpty(Me.ImageName) Then
                g.DrawImage(Me.ImageList.Images(Me.ImageName), cellBounds.Location)
                textBounds.X += Me.ImageList.ImageSize.Width
                textBounds.Width -= Me.ImageList.ImageSize.Width
            End If

            'g.DrawRectangle(Pens.Red, textBounds)

            ' Draw the title
            Dim fmt As New StringFormat(StringFormatFlags.NoWrap)
            fmt.Trimming = StringTrimming.EllipsisCharacter
            fmt.Alignment = StringAlignment.Near
            fmt.LineAlignment = StringAlignment.Near

            Using b As New SolidBrush(Me.TitleColor)
                g.DrawString(Me.Title, Me.TitleFont, b, textBounds, fmt)
            End Using

            ' Draw the description
            Dim size As SizeF = g.MeasureString(Me.Title, Me.TitleFont, CInt(textBounds.Width), fmt)
            textBounds.Y += CInt(size.Height)
            textBounds.Height -= CInt(size.Height)
            Dim fmt2 As New StringFormat()
            fmt2.Trimming = StringTrimming.EllipsisCharacter
            Using b As New SolidBrush(Me.DescriptionColor)
                g.DrawString(Me.Description, Me.DescripionFont, b, textBounds, fmt2)
            End Using

        End Sub
    End Class
还有原来的C

public class NamedDescriptionDecoration : BrightIdeasSoftware.AbstractDecoration
{
    public ImageList ImageList;
    public string ImageName;
    public string Title;
    public string Description;

    public Font TitleFont = new Font("Tahoma", 9, FontStyle.Bold);
    public Color TitleColor = Color.FromArgb(255, 32, 32, 32);
    public Font DescripionFont = new Font("Tahoma", 9);
    public Color DescriptionColor = Color.FromArgb(255, 96, 96, 96);
    public Size CellPadding = new Size(1, 1);

    public override void Draw(BrightIdeasSoftware.ObjectListView olv, Graphics g, Rectangle r) {
        Rectangle cellBounds = this.CellBounds;
        cellBounds.Inflate(-this.CellPadding.Width, -this.CellPadding.Height);
        Rectangle textBounds = cellBounds;

        if (this.ImageList != null && !String.IsNullOrEmpty(this.ImageName)) {
            g.DrawImage(this.ImageList.Images[this.ImageName], cellBounds.Location);
            textBounds.X += this.ImageList.ImageSize.Width;
            textBounds.Width -= this.ImageList.ImageSize.Width;
        }

        //g.DrawRectangle(Pens.Red, textBounds);

        // Draw the title
        StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap);
        fmt.Trimming = StringTrimming.EllipsisCharacter;
        fmt.Alignment = StringAlignment.Near;
        fmt.LineAlignment = StringAlignment.Near;

        using (SolidBrush b = new SolidBrush(this.TitleColor)) {
            g.DrawString(this.Title, this.TitleFont, b, textBounds, fmt);
        }

        // Draw the description
        SizeF size = g.MeasureString(this.Title, this.TitleFont, (int)textBounds.Width, fmt);
        textBounds.Y += (int)size.Height;
        textBounds.Height -= (int)size.Height;
        StringFormat fmt2 = new StringFormat();
        fmt2.Trimming = StringTrimming.EllipsisCharacter;
        using (SolidBrush b = new SolidBrush(this.DescriptionColor)) {
            g.DrawString(this.Description, this.DescripionFont, b, textBounds, fmt2);
        }
    }
}

欢迎来到SO。为了让您的同事更容易提供帮助,您应该非常清楚您已经采取了哪些调试步骤,可以排除哪些步骤,并突出显示源代码中错误的位置。仅仅发布一个完整的程序声明它不起作用肯定会让你名声不好,而不是快速帮助。好的。。请理解,我已经把它缩小到了我的问题:感谢您的输入还包括原始C代码-这将有助于隔离转换问题。好的,作为我添加到转换中的C代码:谢谢。转换看起来很完美-问题一定在别处,也许在设置listview属性的设计器代码中。