Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''' <summary>
- ''' Just A Simple MsgBox Copy
- '''
- ''' Made By SubGenius
- ''' Your project must include the FlatUI skin by iSynthesis
- ''' http://www.hackforums.net/showthread.php?tid=3559385
- '''
- ''' Change the "yourappname" to your applciation name
- ''' </summary>
- ''' <remarks></remarks>
- #Region "Form Design"
- <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
- Partial Class frmMessageBox
- Inherits System.Windows.Forms.Form
- 'Form overrides dispose to clean up the component list.
- <System.Diagnostics.DebuggerNonUserCode()> _
- Protected Overrides Sub Dispose(ByVal disposing As Boolean)
- Try
- If disposing AndAlso components IsNot Nothing Then
- components.Dispose()
- End If
- Finally
- MyBase.Dispose(disposing)
- End Try
- 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()
- Me.TitleLabel = New System.Windows.Forms.Label()
- Me.MessageBox = New System.Windows.Forms.TextBox()
- Me.YesButton = New yourappname.FlatButton()
- Me.NoButton = New yourappname.FlatButton()
- Me.Cancel_ExitButton = New yourappname.FlatButton()
- Me.SuspendLayout()
- '
- 'TitleLabel
- '
- Me.TitleLabel.AutoSize = True
- Me.TitleLabel.Font = New System.Drawing.Font("Century", 20.0!)
- Me.TitleLabel.Location = New System.Drawing.Point(4, 4)
- Me.TitleLabel.Name = "TitleLabel"
- Me.TitleLabel.Size = New System.Drawing.Size(248, 33)
- Me.TitleLabel.TabIndex = 0
- Me.TitleLabel.Text = "The Msgbox Label"
- '
- 'MessageBox
- '
- Me.MessageBox.BackColor = System.Drawing.Color.FromArgb(CType(CType(32, Byte), Integer), CType(CType(32, Byte), Integer), CType(CType(39, Byte), Integer))
- Me.MessageBox.BorderStyle = System.Windows.Forms.BorderStyle.None
- Me.MessageBox.Cursor = System.Windows.Forms.Cursors.Arrow
- Me.MessageBox.Enabled = False
- Me.MessageBox.Font = New System.Drawing.Font("Century Gothic", 9.75!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(161, Byte))
- Me.MessageBox.ForeColor = System.Drawing.Color.White
- Me.MessageBox.HideSelection = False
- Me.MessageBox.Location = New System.Drawing.Point(12, 40)
- Me.MessageBox.Multiline = True
- Me.MessageBox.Name = "MessageBox"
- Me.MessageBox.ReadOnly = True
- Me.MessageBox.Size = New System.Drawing.Size(549, 69)
- Me.MessageBox.TabIndex = 10
- '
- 'YesButton
- '
- Me.YesButton.BackColor = System.Drawing.Color.Transparent
- Me.YesButton.BaseColor = System.Drawing.Color.Crimson
- Me.YesButton.Cursor = System.Windows.Forms.Cursors.Hand
- Me.YesButton.Font = New System.Drawing.Font("Segoe UI", 12.0!)
- Me.YesButton.Location = New System.Drawing.Point(343, 115)
- Me.YesButton.Name = "YesButton"
- Me.YesButton.Rounded = False
- Me.YesButton.Size = New System.Drawing.Size(106, 32)
- Me.YesButton.TabIndex = 11
- Me.YesButton.Text = "Yes"
- Me.YesButton.TextColor = System.Drawing.Color.FromArgb(CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer))
- Me.YesButton.Visible = False
- '
- 'NoButton
- '
- Me.NoButton.BackColor = System.Drawing.Color.Transparent
- Me.NoButton.BaseColor = System.Drawing.Color.Crimson
- Me.NoButton.Cursor = System.Windows.Forms.Cursors.Hand
- Me.NoButton.Font = New System.Drawing.Font("Segoe UI", 12.0!)
- Me.NoButton.Location = New System.Drawing.Point(455, 115)
- Me.NoButton.Name = "NoButton"
- Me.NoButton.Rounded = False
- Me.NoButton.Size = New System.Drawing.Size(106, 32)
- Me.NoButton.TabIndex = 12
- Me.NoButton.Text = "No"
- Me.NoButton.TextColor = System.Drawing.Color.FromArgb(CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer))
- Me.NoButton.Visible = False
- '
- 'Cancel_ExitButton
- '
- Me.Cancel_ExitButton.BackColor = System.Drawing.Color.Transparent
- Me.Cancel_ExitButton.BaseColor = System.Drawing.Color.Crimson
- Me.Cancel_ExitButton.Cursor = System.Windows.Forms.Cursors.Hand
- Me.Cancel_ExitButton.Font = New System.Drawing.Font("Segoe UI", 12.0!)
- Me.Cancel_ExitButton.Location = New System.Drawing.Point(12, 115)
- Me.Cancel_ExitButton.Name = "Cancel_ExitButton"
- Me.Cancel_ExitButton.Rounded = False
- Me.Cancel_ExitButton.Size = New System.Drawing.Size(106, 32)
- Me.Cancel_ExitButton.TabIndex = 13
- Me.Cancel_ExitButton.Text = "Cancel"
- Me.Cancel_ExitButton.TextColor = System.Drawing.Color.FromArgb(CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer))
- Me.Cancel_ExitButton.Visible = False
- '
- 'frmMessageBox
- '
- Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None
- Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(22, Byte), Integer), CType(CType(22, Byte), Integer), CType(CType(29, Byte), Integer))
- Me.ClientSize = New System.Drawing.Size(573, 151)
- Me.Controls.Add(Me.YesButton)
- Me.Controls.Add(Me.NoButton)
- Me.Controls.Add(Me.Cancel_ExitButton)
- Me.Controls.Add(Me.MessageBox)
- Me.Controls.Add(Me.TitleLabel)
- Me.Font = New System.Drawing.Font("Century", 10.0!)
- Me.ForeColor = System.Drawing.Color.White
- Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
- Me.Name = "frmMessageBox"
- Me.ShowIcon = False
- Me.ShowInTaskbar = False
- Me.Text = "yourappname - Message"
- Me.ResumeLayout(False)
- Me.PerformLayout()
- End Sub
- Friend WithEvents TitleLabel As System.Windows.Forms.Label
- Friend WithEvents MessageBox As System.Windows.Forms.TextBox
- Friend WithEvents YesButton As yourappname.FlatButton
- Friend WithEvents NoButton As yourappname.FlatButton
- Friend WithEvents Cancel_ExitButton As yourappname.FlatButton
- End Class
- #End Region
- #Region "Code"
- Public Class frmMessageBox
- #Region "Form Movment"
- Dim offset_x As Integer
- Dim offset_y As Integer
- Dim Form_location As Point
- Dim ej As System.Windows.Forms.MouseEventArgs
- Private IsFormBeingDragged As Boolean = False
- Private MouseDownX As Integer
- Private MouseDownY As Integer
- Private Sub FormRibbon_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown, TitleLabel.MouseDown
- If e.Button = MouseButtons.Left Then
- IsFormBeingDragged = True
- MouseDownX = e.X
- MouseDownY = e.Y
- End If
- End Sub
- Private Sub FormRibbon_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove, TitleLabel.MouseMove
- If IsFormBeingDragged Then
- Dim temp As Point = New Point()
- temp.X = Me.Location.X + (e.X - MouseDownX)
- temp.Y = Me.Location.Y + (e.Y - MouseDownY)
- Me.Location = temp
- temp = Nothing
- End If
- End Sub
- Private Sub FormRibbon_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp, TitleLabel.MouseUp
- If e.Button = MouseButtons.Left Then
- IsFormBeingDragged = False
- End If
- End Sub
- #End Region
- Enum MessageBoxResponse
- _Yes
- _No
- _Cancel
- _Exit
- End Enum
- Enum VisibleButtons
- Yes_No
- Yes_No_Exit
- Yes_No_Cancel
- Cancel
- _Exit
- End Enum
- Public Response As MessageBoxResponse
- ''' <summary>
- ''' Throw A MsgBox Message
- ''' </summary>
- ''' <param name="Title">Message Title</param>
- ''' <param name="Message">Message Iner Message</param>
- ''' <param name="type">Select The Visible Buttons</param>
- ''' <returns></returns>
- ''' <remarks></remarks>
- Public Function ShowMessageBox(ByRef Title As String, ByRef Message As String, ByVal type As VisibleButtons) As MessageBoxResponse
- TitleLabel.Text = Title
- MessageBox.Text = Message
- HideAll()
- Select Case type
- Case VisibleButtons.Cancel
- Cancel_ExitButton.Visible = True
- Case VisibleButtons.Yes_No
- YesButton.Visible = True
- NoButton.Visible = True
- Case VisibleButtons.Yes_No_Cancel
- YesButton.Visible = True
- NoButton.Visible = True
- Cancel_ExitButton.Visible = True
- Case VisibleButtons.Yes_No_Exit
- YesButton.Visible = True
- NoButton.Visible = True
- Cancel_ExitButton.Visible = True
- Cancel_ExitButton.Text = "Exit"
- Case VisibleButtons._Exit
- Cancel_ExitButton.Visible = True
- Cancel_ExitButton.Text = "Exit"
- End Select
- Me.ShowDialog()
- Return Response
- End Function
- Private Sub YesButton_Click(sender As Object, e As EventArgs) Handles YesButton.Click
- Response = MessageBoxResponse._Yes
- Me.Close()
- End Sub
- Private Sub NoButton_Click(sender As Object, e As EventArgs) Handles NoButton.Click
- Response = MessageBoxResponse._No
- Me.Close()
- End Sub
- Private Sub CancelButton_Click(sender As Object, e As EventArgs) Handles Cancel_ExitButton.Click
- If Cancel_ExitButton.Text = "Cancel" Then
- Response = MessageBoxResponse._Cancel
- Else
- Response = MessageBoxResponse._Exit
- End If
- Me.Close()
- End Sub
- Sub HideAll()
- YesButton.Visible = False
- NoButton.Visible = False
- Cancel_ExitButton.Visible = False
- End Sub
- End Class
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment