cs_ghuysmans99
Messages postés3983Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention30 juin 2013
-
17 août 2010 à 20:16
ZaidMarkabi
Messages postés12Date d'inscriptionsamedi 22 août 2009StatutMembreDernière intervention18 août 2010
-
18 août 2010 à 17:32
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
ZaidMarkabi
Messages postés12Date d'inscriptionsamedi 22 août 2009StatutMembreDernière intervention18 août 2010 18 août 2010 à 17:32
indeed, i don't have the time to clean it up,
please if you have the time to sort and publish again, thats will help other developers,
thanks again,
Best Regards.
cs_ghuysmans99
Messages postés3983Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention30 juin 201316 18 août 2010 à 09:09
So update your program, it will be easier to understand for beginners (there's a lot here)
ZaidMarkabi
Messages postés12Date d'inscriptionsamedi 22 août 2009StatutMembreDernière intervention18 août 2010 17 août 2010 à 23:05
that's right,
thanks for your ideas,
cs_ghuysmans99
Messages postés3983Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention30 juin 201316 17 août 2010 à 20:16
Some tips :
- Indent your code, it will be easier to read by other one
- Concatenate strings with & but not +
- Don't use Variant variables (Dim x, y As Integer => x is Variant)
- Optimize your code :
If A=1 Then
If B=2 Then 'do something
End If
#is equal to ...
If A=1 And B=2 Then 'do something
#but the second syntax is shorter and easier to read !
Private Sub ZoomList_Change()
Dim li As Integer : li = ZoomList.ListIndex
With Me.Picture3
If li >= 0 And li < 13 Then
.ScaleHeight = 2 ^ (li + 1) / 10
ElseIf li > 12 And li < 17 Then
.ScaleHeight = 1638.4 * 2 ^ (li - 13)
'.ScaleHeight = (1024/10)*16 * 2^(li - 13)
ElseIf li > 16 And li < 20 Then
.ScaleHeightOpt = 52428.8 * 2 ^ (li - 17)
'.ScaleHeight = (1024/10)*512 * 2^(li - 17)
End If
.ScaleWidth = .ScaleHeight
End With
End Sub
18 août 2010 à 17:32
please if you have the time to sort and publish again, thats will help other developers,
thanks again,
Best Regards.
18 août 2010 à 09:09
17 août 2010 à 23:05
thanks for your ideas,
17 août 2010 à 20:16
- Indent your code, it will be easier to read by other one
- Concatenate strings with & but not +
- Don't use Variant variables (Dim x, y As Integer => x is Variant)
- Optimize your code :
If A=1 Then
If B=2 Then 'do something
End If
#is equal to ...
If A=1 And B=2 Then 'do something
#but the second syntax is shorter and easier to read !
Private Sub ZoomList_Change()
Dim li As Integer : li = ZoomList.ListIndex
With Me.Picture3
If li >= 0 And li < 13 Then
.ScaleHeight = 2 ^ (li + 1) / 10
ElseIf li > 12 And li < 17 Then
.ScaleHeight = 1638.4 * 2 ^ (li - 13)
'.ScaleHeight = (1024/10)*16 * 2^(li - 13)
ElseIf li > 16 And li < 20 Then
.ScaleHeightOpt = 52428.8 * 2 ^ (li - 17)
'.ScaleHeight = (1024/10)*512 * 2^(li - 17)
End If
.ScaleWidth = .ScaleHeight
End With
End Sub
Isn't it shorter ?