Option Strict Off
Option Explicit On
Friend Class FrmProgress
	Inherits System.Windows.Forms.Form
#Region "Windows フォーム デザイナによって生成されたコード"
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'スタートアップ フォームについては、最初に作成されたインスタンスが既定インスタンスになります。
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'この呼び出しは、Windows フォーム デザイナで必要です。
		InitializeComponent()
	End Sub
	'Form は、コンポーネント一覧に後処理を実行するために dispose をオーバーライドします。
	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
	'Windows フォーム デザイナで必要です。
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents ProgressBar1 As AxMSComctlLib.AxProgressBar
	Public WithEvents Timer1 As System.Windows.Forms.Timer
	Public WithEvents LblMessage As System.Windows.Forms.Label
	'メモ : 以下のプロシージャは Windows フォーム デザイナで必要です。
	'Windows フォーム デザイナを使って変更できます。
	'コードエディタを使って修正しないでください。


	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FrmProgress))
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.ProgressBar1 = New AxMSComctlLib.AxProgressBar
        Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
        Me.LblMessage = New System.Windows.Forms.Label
        CType(Me.ProgressBar1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'ProgressBar1
        '
        Me.ProgressBar1.Location = New System.Drawing.Point(8, 30)
        Me.ProgressBar1.Name = "ProgressBar1"
        Me.ProgressBar1.OcxState = CType(resources.GetObject("ProgressBar1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.ProgressBar1.Size = New System.Drawing.Size(297, 26)
        Me.ProgressBar1.TabIndex = 0
        '
        'Timer1
        '
        Me.Timer1.Enabled = True
        Me.Timer1.Interval = 20
        '
        'LblMessage
        '
        Me.LblMessage.BackColor = System.Drawing.SystemColors.Control
        Me.LblMessage.Cursor = System.Windows.Forms.Cursors.Default
        Me.LblMessage.ForeColor = System.Drawing.SystemColors.ControlText
        Me.LblMessage.Location = New System.Drawing.Point(16, 8)
        Me.LblMessage.Name = "LblMessage"
        Me.LblMessage.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.LblMessage.Size = New System.Drawing.Size(161, 18)
        Me.LblMessage.TabIndex = 1
        Me.LblMessage.Text = "イメージ受信中・・・"
        '
        'FrmProgress
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.ClientSize = New System.Drawing.Size(314, 68)
        Me.Controls.Add(Me.ProgressBar1)
        Me.Controls.Add(Me.LblMessage)
        Me.Cursor = System.Windows.Forms.Cursors.Default
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Location = New System.Drawing.Point(3, 29)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "FrmProgress"
        Me.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "VB Sample"
        CType(Me.ProgressBar1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
#End Region 
#Region "アップグレード ウィザードのサポート コード"
	Private Shared m_vb6FormDefInstance As FrmProgress
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As FrmProgress
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New FrmProgress()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	
	Public ComId As Short
	
	Private Sub FrmProgress_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		If ComId < 0 Then
			Timer1.Enabled = False
			Exit Sub
		End If
		
		LblMessage.Text = "イメージ受信中．．．"
		
		ProgressBar1.Min = 0
		ProgressBar1.Max = 100
		ProgressBar1.Visible = True
		ProgressBar1.Value = 0
		
		Timer1.Enabled = True
	End Sub
	
	Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer1.Tick
		Dim filesize As Integer
		Dim recvsize As Integer
		Dim ret As Integer
		
		Timer1.Enabled = False
		
		ret = IT4xxx_ImageProgress(ComId, filesize, recvsize)
		
		Select Case ret
			Case IT4xxx_IMG_BUFFCLEAR
				LblMessage.Text = "受信バッファをクリアしています"
			Case IT4xxx_IMG_RECEIVING
				If filesize > 0 And recvsize > 0 Then
					ProgressBar1.Value = recvsize / filesize * 100
				Else
					ProgressBar1.Value = 0
				End If
			Case Else
				ProgressBar1.Value = 0
		End Select
		
		Timer1.Enabled = True
	End Sub
End Class