一样的功能,两种语言不同的定义方式:
第一组:
VB.Net
Public Property setProgressBar() As Integer
Get
Return _progressBar
End Get
Set(ByVal Value As Integer)
_progressBar = Value
Me.Panels(_progressBar).Style = StatusBarPanelStyle.OwnerDraw
End Set
End Property
Get
Return _progressBar
End Get
Set(ByVal Value As Integer)
_progressBar = Value
Me.Panels(_progressBar).Style = StatusBarPanelStyle.OwnerDraw
End Set
End Property
C#:
public int setProgressBar
{
get
{
return _progressBar;
}
set
{
_progressBar = value;
this.Panels[_progressBar].Style = StatusBarPanelStyle.OwnerDraw ;
}
}
{
get
{
return _progressBar;
}
set
{
_progressBar = value;
this.Panels[_progressBar].Style = StatusBarPanelStyle.OwnerDraw ;
}
}
第二组:
VB.Net
Private Sub Reposition(ByVal sender As Object, ByVal sbdevent As System.Windows.Forms.StatusBarDrawItemEventArgs) Handles MyBase.DrawItem
progressBar.Location = New Point(sbdevent.Bounds.X, sbdevent.Bounds.Y)
progressBar.Size = New Size(sbdevent.Bounds.Width, sbdevent.Bounds.Height)
progressBar.Show()
End Sub
progressBar.Location = New Point(sbdevent.Bounds.X, sbdevent.Bounds.Y)
progressBar.Size = New Size(sbdevent.Bounds.Width, sbdevent.Bounds.Height)
progressBar.Show()
End Sub
C#
this.DrawItem += new StatusBarDrawItemEventHandler(Reposition);
{
progressBar.Location=new Point(e.Bounds.X,e.Bounds.Y);
progressBar.Size = new Size(e.Bounds.Width, e.Bounds.Height);
progressBar.Show();
}
private void Reposition(object sender, StatusBarDrawItemEventArgs e)
{
progressBar.Location=new Point(e.Bounds.X,e.Bounds.Y);
progressBar.Size = new Size(e.Bounds.Width, e.Bounds.Height);
progressBar.Show();
}
第三组:构造函数
VB.NET
Public Class ProgressStatus
{
Sub New()
progressBar.Hide()
Me.Controls.Add(progressBar)
End Sub
}
{
Sub New()
progressBar.Hide()
Me.Controls.Add(progressBar)
End Sub
}
C#
public class ProgressStatus
{
public ProgressStatus()
{
progressBar.Hide();
this.Controls.Add(progressBar);
}
}
{
public ProgressStatus()
{
progressBar.Hide();
this.Controls.Add(progressBar);
}
}