Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
tp2_conditionnelles [2017/08/08 16:28] admin [Exo 2] |
tp2_conditionnelles [2017/10/17 08:11] (Version actuelle) ngagniarre [Exo 1] |
||
---|---|---|---|
Ligne 10: | Ligne 10: | ||
* Incrémentation d'un compteur : i = i + 1 peut s'écrire plus vite i++ | * Incrémentation d'un compteur : i = i + 1 peut s'écrire plus vite i++ | ||
+ | * Interface graphique : | ||
+ | <code> | ||
+ | <Grid> | ||
+ | <Button x:Name="btnNouvGroup" Content="Nouveau groupe
" HorizontalAlignment="Left" Height="23" Margin="386,232,0,0" VerticalAlignment="Top" Width="119" RenderTransformOrigin="0.435,0.685" Click="btnNouvGroup_Click"> | ||
+ | <Button.RenderTransform> | ||
+ | <TransformGroup> | ||
+ | <ScaleTransform/> | ||
+ | <SkewTransform AngleX="-0.221"/> | ||
+ | <RotateTransform Angle="-0.271"/> | ||
+ | <TranslateTransform X="0.914" Y="0.034"/> | ||
+ | </TransformGroup> | ||
+ | </Button.RenderTransform> | ||
+ | </Button> | ||
+ | <Button x:Name="btnValider" Content="Valider" HorizontalAlignment="Left" Height="35" Margin="386,265,0,0" VerticalAlignment="Top" Width="121" Click="btnValider_Click"/> | ||
+ | <TextBox x:Name="txtTarif" HorizontalAlignment="Left" Height="21" Margin="162,63,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="72" TextChanged="textBox_TextChanged"/> | ||
+ | <TextBox x:Name="txtAge" HorizontalAlignment="Left" Height="17" Margin="152,152,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="45"/> | ||
+ | <Label x:Name="label" Content="Age personne:" HorizontalAlignment="Left" Height="46" Margin="61,146,0,0" VerticalAlignment="Top" Width="94"/> | ||
+ | <Label x:Name="label1" Content="Nombre de personnes:" HorizontalAlignment="Left" Height="29" Margin="58,230,0,0" VerticalAlignment="Top" Width="139"/> | ||
+ | <Label x:Name="label2" Content="Montant total à régler:" HorizontalAlignment="Left" Height="36" Margin="58,264,0,0" VerticalAlignment="Top" Width="152"/> | ||
+ | <Label x:Name="lblMontantTotal" Content="" HorizontalAlignment="Left" Height="32" Margin="200,263,0,0" VerticalAlignment="Top" Width="109" RenderTransformOrigin="0.5,0.5"> | ||
+ | <Label.RenderTransform> | ||
+ | <TransformGroup> | ||
+ | <ScaleTransform/> | ||
+ | <SkewTransform/> | ||
+ | <RotateTransform Angle="-0.366"/> | ||
+ | <TranslateTransform/> | ||
+ | </TransformGroup> | ||
+ | </Label.RenderTransform> | ||
+ | </Label> | ||
+ | <Label x:Name="label3" Content="Tarif de base du voyage:" HorizontalAlignment="Left" Height="43" Margin="17,60,0,0" VerticalAlignment="Top" Width="147"/> | ||
+ | <Label x:Name="label4" Content="Euros" HorizontalAlignment="Left" Height="43" Margin="239,61,0,0" VerticalAlignment="Top" Width="71"/> | ||
+ | <Label x:Name="lblNbPers" Content="" HorizontalAlignment="Left" Height="26" Margin="197,233,0,0" VerticalAlignment="Top" Width="32" RenderTransformOrigin="0.389,0.597"/> | ||
+ | |||
+ | </Grid> | ||
+ | </code> | ||
===== Exo 2 ===== | ===== Exo 2 ===== | ||
+ | * Variables à utiliser : totDeb, totCred, solde | ||
- | Cocher un bouton radio par défaut : | + | * Cocher un bouton radio par défaut soit par la fenêtre des propriétés soit par le code : |
<code | A placer dans le MainWindow()> | <code | A placer dans le MainWindow()> | ||
rdoDebit.IsChecked = true; | rdoDebit.IsChecked = true; | ||
</code> | </code> | ||
+ | |||
+ | * Concaténation du texte facile avec string.Concat, on met chaque élément à concaténer dans la parenthèse, séparé par une virgule. On peut ajouter du texte brut en le mettant entre "". | ||
+ | * Interface graphique (Recliquer sur les boutons pour les réassigner): | ||
+ | <code> | ||
+ | <Grid> | ||
+ | <TextBox x:Name="txtIntitule" HorizontalAlignment="Left" Height="18" Margin="162,52,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="143"/> | ||
+ | <TextBox x:Name="txtMontant" HorizontalAlignment="Left" Height="18" Margin="162,75,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="143"/> | ||
+ | <RadioButton x:Name="rdoDebit" Content="Débit" HorizontalAlignment="Left" Margin="162,107,0,0" VerticalAlignment="Top" GroupName="j" IsChecked="True"/> | ||
+ | <RadioButton x:Name="rdoCredit" Content="Crédit" HorizontalAlignment="Left" Margin="254,107,0,0" VerticalAlignment="Top" GroupName="j"/> | ||
+ | <Label x:Name="label" Content="Montant:" HorizontalAlignment="Left" Height="41" Margin="104,70,0,0" VerticalAlignment="Top" Width="60"/> | ||
+ | <Label x:Name="label1" Content="Intitule:" HorizontalAlignment="Left" Height="28" Margin="111,46,0,0" VerticalAlignment="Top" Width="72"/> | ||
+ | <Button x:Name="btnAjouter" Content="Ajouter" HorizontalAlignment="Left" Height="32" Margin="31,107,0,0" VerticalAlignment="Top" Width="110"/> | ||
+ | <Label x:Name="label2" Content="Ajout d'opération" HorizontalAlignment="Left" Height="50" Margin="10,15,0,0" VerticalAlignment="Top" Width="126"/> | ||
+ | <Label x:Name="label3" Content="Débit" HorizontalAlignment="Left" Height="41" Margin="61,159,0,0" VerticalAlignment="Top" Width="80"/> | ||
+ | <Label x:Name="label3_Copy" Content="Crédit" HorizontalAlignment="Left" Height="41" Margin="299,159,0,0" VerticalAlignment="Top" Width="80"/> | ||
+ | <Label x:Name="lblDebit" Content="" HorizontalAlignment="Left" Height="127" Margin="31,182,0,0" VerticalAlignment="Top" Width="223" BorderThickness="1" BorderBrush="Black"/> | ||
+ | <Label x:Name="lblCredit" Content="" HorizontalAlignment="Left" Height="127" Margin="284,182,0,0" VerticalAlignment="Top" Width="223" BorderThickness="1" BorderBrush="Black"/> | ||
+ | <Label x:Name="label4" Content="Total débit:" HorizontalAlignment="Left" Height="38" Margin="31,314,0,0" VerticalAlignment="Top" Width="115"/> | ||
+ | <Label x:Name="label4_Copy" Content="Total crédit:" HorizontalAlignment="Left" Height="38" Margin="284,314,0,0" VerticalAlignment="Top" Width="115"/> | ||
+ | <Label x:Name="lblTotDebit" Content="" HorizontalAlignment="Left" Height="31" Margin="183,314,0,0" VerticalAlignment="Top" Width="71" BorderBrush="Black" BorderThickness="1"/> | ||
+ | <Label x:Name="lblTotCredit" Content="" HorizontalAlignment="Left" Height="31" Margin="436,314,0,0" VerticalAlignment="Top" Width="71" BorderBrush="Black" BorderThickness="1"/> | ||
+ | <Label x:Name="label5" Content="Solde" HorizontalAlignment="Left" Height="31" Margin="41,373,0,0" VerticalAlignment="Top" Width="95"/> | ||
+ | <Label x:Name="lblSolde" Content="" HorizontalAlignment="Left" Height="31" Margin="93,373,0,0" VerticalAlignment="Top" Width="71" BorderBrush="Black" BorderThickness="1"/> | ||
+ | |||
+ | </Grid> | ||
+ | </code> |