1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
   | Public Class frmEditCutsPoints
    Private _Index As Integer
    Private _Cuts As clsVideo.clsCuts
    Private _CurrentCut As clsVideo.clsCut
    Private _LimiteBasse As Integer
    Private _LimiteHaute As Integer
    Private _IsLoaded As Boolean
 
    Public Sub New(ByVal Cuts As clsVideo.clsCuts, ByVal Index As Integer)
 
        ' Cet appel est requis par le concepteur.
        InitializeComponent()
 
        ' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
        'Me.Location = MousePosition
 
        _Index = Index
        _Cuts = Cuts
        _CurrentCut = Cuts.Item(Index)
 
        _LimiteBasse = 0
        If _Index > 0 Then _LimiteBasse = _Cuts.Item(_Index - 1).Cut_Out + 100
        _LimiteHaute = clsVideo.clsMediaData.NbFrames
        If _Index < _Cuts.Items.Count - 1 Then _LimiteHaute = _Cuts.Item(_Index + 1).Cut_In - 100
 
        LastValideCutIn = _CurrentCut.Cut_In
        LastValideCutOut = _CurrentCut.Cut_Out
        NumericUpDownIn.Minimum = _LimiteBasse
        NumericUpDownIn.Maximum = _LimiteHaute
        NumericUpDownOut.Minimum = _LimiteBasse
        NumericUpDownOut.Maximum = _LimiteHaute
 
        NumericUpDownIn.Value = _CurrentCut.Cut_In
        NumericUpDownOut.Value = _CurrentCut.Cut_Out
 
        _IsLoaded = True
    End Sub
 
    Dim LastValideCutIn As Integer
    Private Sub NumericUpDownIn_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDownIn.ValueChanged
        If _IsLoaded = False Then Exit Sub
        If (NumericUpDownOut.Value - NumericUpDownIn.Value) < 100 Then
            MessageBox.Show("Le segment doit être supérieur à 100 frames")
            NumericUpDownIn.Value = LastValideCutIn
        End If
    End Sub
    Dim LastValideCutOut As Integer
    Private Sub NumericUpDownOut_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDownOut.ValueChanged
        If _IsLoaded = False Then Exit Sub
        If (NumericUpDownOut.Value - NumericUpDownIn.Value) < 100 Then
            MessageBox.Show("Le segment doit être supérieur à 100 frames")
            NumericUpDownOut.Value = LastValideCutOut
        End If
    End Sub
 
    Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
        _CurrentCut.Cut_In = CInt(NumericUpDownIn.Value)
        _CurrentCut.Cut_Out = CInt(NumericUpDownOut.Value)
        Me.Close()
    End Sub
End Class | 
Partager