在VB.NET中怎样将进度条容入状态栏中?

ccg68 2004-08-29 07:53:41
在VB.NET中怎样将进度条容入状态栏中?我的意思不是将进度条放到状态栏上,而是进度条作为状态栏的一个Panel。
...全文
225 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
NoReady 2004-08-30
  • 打赏
  • 举报
回复
我这里有一个外国网友写的,没仔细看过,分2个文件 :
----------------------------
ProgressStatus.vb中的代码:

------------------
Public Class ProgressStatus : Inherits StatusBar
Public progressBar As New ProgressBar
Private _progressBar As Integer = -1

Sub New()
progressBar.Hide()

Me.Controls.Add(progressBar)
End Sub

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

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
End Class



使用它的form1.vb的代码如下:
-------------------------
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region

Public StatusBar As New ProgressStatus

Private Sub InitializeStatusBar()
Dim info = New System.Windows.Forms.StatusBarPanel
Dim progress = New System.Windows.Forms.StatusBarPanel

info.Text = "Ready"
info.Width = 100

progress.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring

With StatusBar
.Panels.Add(info)
.Panels.Add(progress)
.ShowPanels = True
.setProgressBar = 1
.progressBar.Minimum = 0
.progressBar.Maximum = 100
End With

Me.Controls.Add(StatusBar)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeStatusBar()
StatusBar.progressBar.Value = 50
End Sub
End Class

dofly 2004-08-29
  • 打赏
  • 举报
回复
别人写的,好像是水如烟吧.
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region

Public StatusBar As New ProgressStatus

Private Sub InitializeStatusBar()
Dim info = New System.Windows.Forms.StatusBarPanel
Dim progress = New System.Windows.Forms.StatusBarPanel

info.Text = "Ready"
info.Width = 100

progress.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring

With StatusBar
.Panels.Add(info)
.Panels.Add(progress)
.ShowPanels = True
.setProgressBar = 1
.progressBar.Minimum = 0
.progressBar.Maximum = 100
End With

Me.Controls.Add(StatusBar)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeStatusBar()
StatusBar.progressBar.Value = 50
End Sub
End Class
内容概要:本文系统研究了基于豪猪优化算法(CPO)的多无人机协同集群在三维空间的避障路径规划问题,聚焦于实现以最低成本为目标的航迹优化,综合考虑路径长度、飞行高度、威胁规避及转弯角度等多个关键因素。通过构建精细化的三维环境模型与多无人机协同机制,采用Matlab平台实现CPO算法的仿真与验证,充分展示了该算法在复杂动态障碍环境下的高效搜索能力与全局优化性能。研究不仅涵盖了路径规划的数学建模与目标函数设计,还深入探讨了算法的收敛特性与鲁棒性,为智能群体系统在实际场景的应用提供了理论依据与技术支撑。; 适合人群:具备一定编程基础和优化算法背景,从事无人机系统控制、智能路径规划、群体协同、人工智能与自动化等相关领域的科研人员、高校研究生及工程技术人员。; 使用场景及目标:①应用于多无人机协同执行侦察、灾害监测、应急救援、区域巡检等复杂任务的自主路径规划;②为智能优化算法在三维动态环境下的路径决策问题提供可复现的技术范例;③支持研究人员对CPO算法与其他主流群智能算法(如PSO、GWO、WOA等)进行性能对比与改进研究,推动路径规划技术的发展。; 阅读建议:建议结合提供的Matlab代码进行实践操作,重点理解目标函数的多维度建模方式与CPO算法的迭代优化流程,可通过调整环境参数与约束条件进行仿真实验,对比不同算法在相同场景下的路径质量与收敛速度,从而深入掌握其优势与适用边界。
内容概要:本文围绕电动汽车参与电力系统运行备用的能力评估展开深入研究,利用Matlab代码实现对电动汽车集群提供运行备用服务的建模与仿真分析。研究重点在于量化电动汽车作为分布式灵活资源参与电网辅助服务的潜力,通过构建精细化的数学模型,分析其可调功率容量、响应速度、时空分布特性及聚合能力,并采用多面体聚合、内近似模型与闵可夫斯基和等先进方法精确刻画其可调度能力边界。研究进一步结合大规模电动汽车接入场景,探讨其在多时间尺度调度框架下参与调峰、调频等辅助服务的优化策略,评估其对提升高比例可再生能源电网灵活性与稳定性的贡献,最终通过仿真验证所提模型与方法的有效性与实用性。; 适合人群:具备电力系统分析、智能电网、新能源汽车或优化调度等相关专业背景,熟悉Matlab/Simulink仿真工具,从事科研、工程应用的高校研究生、科研人员及电力行业工程师。; 使用场景及目标:①精确评估大规模电动汽车集群在不同约束条件下可提供的运行备用容量;②研究电动汽车在日前、日内及实时调度的动态响应能力与优化调度策略;③为高渗透率新能源电力系统提供基于移动储能的灵活性资源解决方案,支撑电网安全经济运行。; 阅读建议:建议结合Matlab代码与技术文档同步学习,重点关注多面体聚合建模、能力边界计算及优化调度算法的设计与实现,可进一步拓展至V2G(车辆到电网)、需求响应等互动场景进行二次开发与应用验证。

16,718

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧