directcast d'une structure
Bonjour,
Suite à un post récent, j'ai déclaré une structure:
Code:
1 2 3 4 5 6 7 8 9
| <StructLayout(LayoutKind.Sequential)>
Friend Structure WindowPlacement
Friend Property Length As Integer
Friend Property Flags As Integer
Friend Property ShowCommand As Integer
Friend Property MinPosition As Point
Friend Property MaxPosition As Point
Friend Property NormalPosition As Rectangle
End Structure |
Quand je déclare un objet utilisant cette structure, j'ai ce code:
Code:
1 2 3 4 5 6 7 8 9 10
| Dim MonWP As New WindowPlacement()
' Affectation des valeurs par défaut de MonWP
With MonWP
.Length = Marshal.SizeOf(MonWP)
.ShowCommand = 0
.Flags = 1
.MinPosition = New Point(-1, -1)
.MaxPosition = New Point(-1, -1)
.NormalPosition = New Rectangle(10, 10, 100, 100)
End With |
est-il possible de faire une seule ligne du genre: Dim MonWP as WindowPlacement = directcast(quelquechose, quelquechose)?
Merci d'avance de vos réponses