Jump to content
Sign in to follow this  
pipasmeimoa

Termómetro

Recommended Posts

pipasmeimoa

Estou a tentar criar um termómetro através de uma picture que vá carregar uma imagem de uma barra com a temperatura máxima e mínima... mas não esta a dar certo  :wallbash:

Deixo aqui o código, agradecia ajuda ou ate mesmo alguma ideia  :cheesygrin:

Dim temp(5) As Single, i As Integer, menor As Single, maior As Single, amp1 As Single

Private Sub amp_Click()
Dim amp As Single
amp = maior - menor
amp = Round(amp, 2)

amplitude.Caption = " Registou-se uma aplitude termica de : " & amp

End Sub



Private Sub Introduzir_Click()
Dim i As Integer

For i = 0 To 5
    temp(i) = Val(InputBox("Introduza a " & i & "Temperatura.", "Caixa de entrada de valores!"))
Next i

End Sub

Private Sub Limpar_Click()

Picture1.Picture = LoadPicture

End Sub

Private Sub max_Click()
Dim i As Integer

maior = temp(0)

For i = 0 To 5
    If maior > temp(i) Then
        maior = temp(i)
        temperaturas.Print temp(i); Chr(13)
    End If
Next i

If menor < -30 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-30.jpg")
ElseIf menor >= -30 Or menor < -20 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-25.jpg")
ElseIf menor >= -20 Or menor < -10 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-15.jpg")
ElseIf menor >= -10 Or menor < 0 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-5.jpg")
ElseIf maior >= 0 Or maior < 10 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\5.jpg")
ElseIf maior >= 10 Or maior < 20 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\15.jpg")
ElseIf maior >= 20 Or maior < 30 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\25.jpg")
ElseIf maior >= 30 Or maior < 40 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\35.jpg")
ElseIf maior >= 40 Or maior < 50 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\45.jpg")
ElseIf maior >= 50 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\+50.jpg")
End If











End Sub

Private Sub min_Click()
Dim i As Integer

menor = temp(0)


For i = 0 To 5
    If menor < temp(i) Then
        menor = temp(i)
        temperaturas.Print temp(i); Chr(13)
    End If
Next i

If menor < -30 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-30.jpg")
ElseIf menor >= -30 Or menor < -20 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-25.jpg")
ElseIf menor >= -20 Or menor < -10 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-15.jpg")
ElseIf menor >= -10 Or menor < 0 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\-5.jpg")
ElseIf maior >= 0 Or maior < 10 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\5.jpg")
ElseIf maior >= 10 Or maior < 20 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\15.jpg")
ElseIf maior >= 20 Or maior < 30 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\25.jpg")
ElseIf maior >= 30 Or maior < 40 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\35.jpg")
ElseIf maior >= 40 Or maior < 50 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\45.jpg")
ElseIf maior >= 50 Then
Picture1.Picture = LoadPicture("C:\Users\Filipe\Desktop\PSI 11ºM\Imag\15.2 inagens\+50.jpg")
End If

End Sub

Private Sub Sair_Click()
End
End Sub


FILIPE_CORREIA

Share this post


Link to post
Share on other sites
Gooden

1º Cuidado com o português....
2º O titulo têm que ser sugestivo.
3º Usa as tags [ code=vb ] 

4º não está a dar certo??? mas qual o problema? Se mais especifico.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.