client/frmPreload.vb

157 lines
6.1 KiB
VB.net
Raw Blame History

Public Class frmPreload
Inherits System.Windows.Forms.Form
Private mensaje As String
#Region "Variables"
'Var Internas para la localizacion y size inicial del formPreload
Private mLocationInicialPic, mLocationInicialLab As System.Drawing.Point
Private mSizeInicialPreload As System.Drawing.Size
Private factorEscalaX, factorEscalaY As Integer
' Obj del preload
Private WithEvents picAjax As System.Windows.Forms.PictureBox
Friend WithEvents lblmsg As System.Windows.Forms.Label
Private WithEvents lbTextoPreload As System.Windows.Forms.Label
#End Region
#Region "Constructor/Finalizadores"
''' <summary>
''' Constructor publico para instanciar el preload en un formulario pasando como
''' parametros el objeto que invoca.
''' </summary>
''' <remarks></remarks>
Public Sub New(ByVal _formInvocador As System.Windows.Forms.Form, ByVal msg As String)
MyBase.New()
mensaje = msg
Me.InitializeComponent()
Me.inicializarPreload(_formInvocador)
End Sub
''' <summary>
''' Destructor
''' </summary>
''' <remarks></remarks>
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
#End Region
#Region "Eventos"
''' <summary>
''' Closing
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub frmPreload_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If e.CloseReason = CloseReason.UserClosing Then
e.Cancel = True
End If
End Sub
#End Region
#Region "Inicializadores de Componentes"
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmPreload))
Me.picAjax = New System.Windows.Forms.PictureBox()
Me.lbTextoPreload = New System.Windows.Forms.Label()
Me.lblmsg = New System.Windows.Forms.Label()
CType(Me.picAjax, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'picAjax
'
Me.picAjax.BackColor = System.Drawing.Color.WhiteSmoke
Me.picAjax.Image = CType(resources.GetObject("picAjax.Image"), System.Drawing.Image)
Me.picAjax.Location = New System.Drawing.Point(95, 113)
Me.picAjax.Name = "picAjax"
Me.picAjax.Size = New System.Drawing.Size(50, 50)
Me.picAjax.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage
Me.picAjax.TabIndex = 8
Me.picAjax.TabStop = False
'
'lbTextoPreload
'
Me.lbTextoPreload.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lbTextoPreload.AutoSize = True
Me.lbTextoPreload.BackColor = System.Drawing.Color.Transparent
Me.lbTextoPreload.ForeColor = System.Drawing.Color.DimGray
Me.lbTextoPreload.Location = New System.Drawing.Point(50, 150)
Me.lbTextoPreload.Name = "lbTextoPreload"
Me.lbTextoPreload.Size = New System.Drawing.Size(0, 13)
Me.lbTextoPreload.TabIndex = 9
'
'lblmsg
'
Me.lblmsg.AutoSize = True
Me.lblmsg.ForeColor = System.Drawing.Color.Blue
Me.lblmsg.Location = New System.Drawing.Point(92, 267)
Me.lblmsg.Name = "lblmsg"
Me.lblmsg.Size = New System.Drawing.Size(39, 13)
Me.lblmsg.TabIndex = 10
Me.lblmsg.Text = "Label1"
'
'frmPreload
'
Me.BackColor = System.Drawing.Color.White
Me.ClientSize = New System.Drawing.Size(249, 289)
Me.Controls.Add(Me.lblmsg)
Me.Controls.Add(Me.picAjax)
Me.Controls.Add(Me.lbTextoPreload)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmPreload"
Me.Opacity = 0.7R
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.TopMost = True
CType(Me.picAjax, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
#Region "Metodos Privados"
''' <summary>
''' Metodo para obtener localizacion
''' </summary>
''' <param name="_form"></param>
''' <remarks></remarks>
Private Sub inicializarPreload(ByVal _form As System.Windows.Forms.Form)
'Supendemos el dise<73>o
Me.SuspendLayout()
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
Me.ShowInTaskbar = False
'' Localizacion Inicial de los objetos
mLocationInicialPic = Me.picAjax.Location
mLocationInicialLab = Me.lbTextoPreload.Location
'' Size inicial del formpreload
mSizeInicialPreload = Me.Size
'' Aplicamos el size y location del formulario ....
Me.Size = _form.Size
Me.Location = _form.Location
'' Obtenemos el factor Localizacion con este algoritmo
factorEscalaX = (_form.Size.Width - mSizeInicialPreload.Width) / 2
factorEscalaY = (_form.Size.Height - mSizeInicialPreload.Height) / 2
'' A la localizacion inicial del picture sumamos eel nuevo valor obtenido
mLocationInicialPic.X += factorEscalaX
mLocationInicialPic.Y += factorEscalaY
'' Idem a label
mLocationInicialLab.X += factorEscalaX
mLocationInicialLab.Y += factorEscalaY
'' Aplicamos nuevas localizaciones
Me.picAjax.Location = New System.Drawing.Point(mLocationInicialPic.X, mLocationInicialPic.Y)
Me.lbTextoPreload.Location = New System.Drawing.Point(mLocationInicialLab.X, mLocationInicialLab.Y)
lblmsg.Text = mensaje
'Reiniciamos el dise<73>o
Me.ResumeLayout()
End Sub
#End Region
Private Sub frmPreload_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
End Sub
End Class