Toshiba_Kanban_Issuance/Mounting Sequence/Forms/myMessageBox.vb

39 lines
1.7 KiB
VB.net

Public Class myMessageBox
Inherits Form
Private WithEvents Btn As New Button
Private Message As String
'Private Sub New()
' Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
' MinimizeBox = False
' MaximizeBox = False
' Size = New Size(300, 300)
' With Btn
' .SetBounds(Width - 100, 180, 75, 60)
' .Text = "OK"
' End With
' Controls.Add(Btn)
'End Sub
Public Overloads Shared Sub Show(ByVal Message As String)
Dim F As New myMessageBox
F.Message = Message
F.CenterToScreen()
F.ShowDialog()
End Sub
Private Sub myMessageBox_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.FillRectangle(Brushes.Beige, New Rectangle(0, 0, ClientRectangle.Width, 250))
e.Graphics.DrawIcon(SystemIcons.Information, 10, 30 - SystemIcons.Exclamation.Height \ 2)
'Dim Rect As New Rectangle(SystemIcons.Information.Width + 20, 0, Width - 20 - SystemIcons.Information.Width, 70)
Dim Rect As New Rectangle(SystemIcons.Information.Width + 20, 0, Width - 20 - SystemIcons.Information.Width, 300)
Dim Fmt As New StringFormat
'Fmt.LineAlignment = StringAlignment.Center
Fmt.LineAlignment = StringAlignment.Near
e.Graphics.DrawString(Message, New Font("Segoe UI", 16), Brushes.Blue, Rect, Fmt)
End Sub
Private Sub Btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn.Click
DialogResult = Windows.Forms.DialogResult.OK
End Sub
Private Sub myMessageBox_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
End Sub
End Class