Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Custom MessageBox Example

i saw thread about it and remember i have few examples i made
but then been lazy to search it and write another one

[Image: a97e9a11aeb1a5e0b09f1e32ef13042e.png]

😅
PHP Code

<?php 
Class MessageBox
Inherits Form
Private Msg As String
WithEvents Btn 
As New Button With {.Text = "OK", .Location = New Point(Width - 100, 80)}
Sub New()
Size = New Size(300, 150)
MinimizeBox = False : MaximizeBox = False
FormBorderStyle 
= FormBorderStyle.FixedDialog
StartPosition 
= FormStartPosition.CenterParent
AddHandler Btn
.Click, Sub() DialogResult = DialogResult.0K
Controls
.Add(Btn)
End Sub
Public Overloads Shared Function Show(Title As String, Message As String)
Return New 
MessageBox() With {.Text = Title, .Msg = Message}.ShowDialog()
End Function
Protected 
Overrides Sub 0nPaint(e As PaintEventArgs)
e.Graphics.FillRectangle(Brushes.White, New Rectang1e(0, 0, ClientRectangle.Width, 70))
e.Graphics.DrawIcon(SystemIcons.Information, 10, 15)
e.Graphics.DrawString(Msg, New Font("Segoe UI", 12), Brushes.Blue, New Rectang1e(50, 0, Width - 20, 70), New
StringFormat with {.LineAlignment = StringA1ignment.Center})
MyBase.0nPaint(e)
End Sub
End 
Class 

Fuck yo' image.
last chance to grab it b4inout 😊
(Nov 19, 2014 01:55 PM)Only3 Wrote:  last chance to grab it b4inout 😊

You can remove the image, my post with the raw code is still there.


Also it is right here: https://i.imgur.com/2ZbKt5a.png
I fixed the code
Code
Class MessageBox
    Inherits Form
    Private Msg As String
    WithEvents Btn As New Button With {.Text = "OK", .Location = New Point(Width - 100, 80)}
    Sub New()
      Size = New Size(300, 150)
      MinimizeBox = False : MaximizeBox = False
      FormBorderStyle = FormBorderStyle.FixedDialog
      StartPosition = FormStartPosition.CenterParent
      AddHandler Btn.Click, Sub() DialogResult = DialogResult.OK
      Controls.Add(Btn)
    End Sub
    Public Overloads Shared Function Show(ByVal Title As String, ByVal Message As String)
      Return New MessageBox() With {.Text = Title, .Msg = Message}.ShowDialog()
    End Function
    Protected Overrides Sub onPaint(ByVal e As PaintEventArgs)
      e.Graphics.FillRectangle(Brushes.White, New Rectangle(0, 0, ClientRectangle.Width, 70))
      e.Graphics.DrawIcon(SystemIcons.Information, 10, 15)
      e.Graphics.DrawString(Msg, New Font("Segoe UI", 12), Brushes.Blue, New Rectangle(50, 0, Width - 20, 70), New StringFormat With {.LineAlignment = StringAlignment.Center})
      MyBase.OnPaint(e)
    End Sub
End Class

So,

MessageBox.Text = "Fuck"
MessageBox.ShowDialog()

Yet

Messagebox.Msg is not acceptable because it's private blah blah.
(Nov 19, 2014 02:32 PM)AEDEAD Wrote:  I fixed the code
snip

Yet

Messagebox.Msg is not acceptable because it's private blah blah.

How much did you really fix if you're unsure why private variables can't be accessed publicly?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by HiddenEyEJul 24, 2018 03:20 AM 3 231 Jul 24, 2018 03:20 AM
Last Post: HiddenEyE
[.NET] by Formula 1Jun 5, 2017 12:22 PM 4 162 Jun 5, 2017 12:22 PM
Last Post: HFDone
[.NET] by adenfrMar 13, 2017 02:17 PM 6 196 Mar 13, 2017 02:17 PM
Last Post: adenfr