Salve
E' da un paio di giorni che sto cercando di generare da codice un MessageBox con i bordi arrotondati.
Ho provato con:
Public Sub my_message_box(responso As Boolean) As Boolean
'Dim my_win_box As Window ' posta nelle "Dichiarazioni"
Dim pc As Picture
Dim my_dwg As DrawingArea
Dim sPath As String
' una qualsiasi immagine png con sfondo trasparente
' con Width minore di questa finestra
' ed Heigth minore di 120 px.
sPath = Application.Path &/ "fatture_user/image/vigiot.png"
pc = Picture.Load(sPath)
responso = False
With my_win_box = New Window As "w_box"
.Width = 450
.Height = 160
.Resizable = False
.Border = False
.Minimized = False
.Background = Color.Transparent
'.Opacity = 0
.Mask = True
End With
With my_dwg = New DrawingArea(my_win_box) As "m_dwg"
.X = 0
.Y = 0
.Width = my_win_box.Width
.Height = my_win_box.Height
.Background = Color.Transparent
End With
my_dwg.Cached = True
With Paint
.Begin(my_dwg)
.Brush = Paint.Color(Color.DarkBlue)
.LineWidth = 2.5
.Rectangle(1, 1, my_win_box.Width - 2, my_win_box.Height - 2, my_win_box.Width / 6)
.Stroke(False)
.DrawPicture(pc, ((my_win_box.Width / 2) - pc.Height / 2), 20, pc.Width, pc.Height)
.Brush = Paint.Color(Color.Black)
.LineWidth = 1
.Rectangle((my_win_box.Width / 2) - 30, my_win_box.Height - 32, 60, 20, 6)
.Stroke(False)
.MoveTo((my_win_box.Width / 2) - 14, my_win_box.Height - 16)
.Font.Bold = True
.Text("OK")
.Fill(True)
.End
End With
responso = my_win_box.ShowModal()
Print responso
Return responso
End
Public Sub m_dwg_MouseDown()
If Mouse.X > ((my_win_box.Width / 2) - 70) Then
If Mouse.Y > (my_win_box.Height - 30) Then
my_win_box.Close(3)
Endif
Endif
End
Ma il rettangolo di sfondo appare comunque.
Settare " .Background = Color.Transparent " della finestra non serve a nulla. ???
Mentre con " .Opacity = 0 " la finestra non si vede proprio ! :o
In compenso il "finto bottone" funziona.
D'accordo che tutto il male non viene per nuocere però ... >:(
Non vorrei che il problema ( a parte quello che sta fra la sedia e la tastiera :coder: ) fosse nel gestore di sistema delle finestre. :hatecomputer:
Qualche suggerimento ?
:ciao: :ciao: