把C#代码转换成VB.NET代码

【ConvertNet2.zip】点击下载此文件
文件来源http://www.softpedia.com/get/Programming/ ... g-Files/Convert-NET.shtml

ConvertNet 8.8
https://fishcodelib.com/Convert.htm


 internal void Render(Graphics graphics)
        {
            m_quadTree.ForEach(delegate(QuadTreeNode<Item> node)
            {

                // draw the contents of this quad
                if (node.Contents != null)
                {
                    foreach (Item item in node.Contents)
                    {
                        using (Brush b = new SolidBrush(item.Color))
                            graphics.FillEllipse(b, Rectangle.Round(item.Rectangle));
                    }
                }

                // draw this quad

                // Draw the border
                Color color = GetColor(node);
                graphics.DrawRectangle(Pens.Black, Rectangle.Round(node.Bounds));
            
                // draw the inside of the border in a distinct colour
                using (Pen p = new Pen(color))
                {
                    Rectangle inside = Rectangle.Round(node.Bounds);
                    inside.Inflate(-1, -1);
                    graphics.DrawRectangle(p, inside);
                }

            });

        }

 Friend Sub Render(ByVal graphics As Graphics)

            ' draw the contents of this quad

            ' draw this quad

            ' Draw the border

            ' draw the inside of the border in a distinct colour

            m_quadTree.ForEach((Sub(node As QuadTreeNode(Of Item))
                                    If node.Contents IsNot Nothing Then
                                        For Each current As Item In node.Contents
                                            Using brush As Brush = New SolidBrush(current.Color)
                                                graphics.FillEllipse(brush, Rectangle.Round(current.Rectangle))
                                            End Using
                                        Next
                                    End If
                                    Dim color As Color = Me.GetColor(node)
                                    graphics.DrawRectangle(Pens.Black, Rectangle.Round(node.Bounds))
                                    Using pen As Pen = New Pen(color)
                                        Dim rect As Rectangle = Rectangle.Round(node.Bounds)
                                        rect.Inflate(-1, -1)
                                        graphics.DrawRectangle(pen, rect)
                                    End Using
                                End Sub))

        End Sub

delegate to  sub





Please follow WeChat's public account ByCAD