06-13-2024, 04:16 PM
(This post was last modified: 06-13-2024, 04:18 PM by Kernelpanic.)
At last a small, successful exercise (would a sub-form of exercises make sense?). A standard program with a picture on the side and a gimmick with color and font.
The program calculates the piston speed of an engine. According to Hütten, engines with a piston speed of over 21 meters per second are in danger of flying apart. The book is 40 years old, wether is that still true today? Maybe!
The picture: Two-Stroke Engine
It's an animated gif. Is there a way to get the animation? I couldn't find anything - or didn't understand it.
The program calculates the piston speed of an engine. According to Hütten, engines with a piston speed of over 21 meters per second are in danger of flying apart. The book is 40 years old, wether is that still true today? Maybe!
The picture: Two-Stroke Engine
Code: (Select All)
'Kolbengeschwindigkeit berechnen - 13. Juni 2024
'Uebung wie man Text und Bild einfuegt
Screen _NewImage(650, 420, 32)
$Color:32
Option _Explicit
Dim As Double kolbenhub, drehzahl, kolbenges
Dim As Long Bild, myFont
Dim As String Text
Bild = _LoadImage("..\..\Bilder\Zweitackter.gif") 'Siehe Hinweis unten um das Bild zu erhalten
_PutImage (470, 35), Bild 'Platzierung des Bildes. Haengt von der Fenstergroesse ab
Locate 2, 3
Print "Berechnung der Kolbengeschwindigkeit"
Locate 3, 3
Print "===================================="
Locate 5, 3
Input "Kolbenhub in cm : ", kolbenhub
Locate 6, 3
Input "Motordrehzahl bei hoechster Leistung: ", drehzahl
'Formel fuer die Kolbengeschwindigkeit - H. Huetten
kolbenges = (((2 * kolbenhub) * drehzahl) / (60 * 100))
If kolbenges <= 21 Then
Locate 8, 3
Print Using "Die Kolbengeschwindigkeit betraegt : ##.##"; kolbenges
Else
Locate 8, 3
Beep: Color Red, 0
Print Using "Die Kolbengeschwindigkeit liegt ueber 21 m/sec: ##.##"; kolbenges
Locate 9, 3
Color White, 0
Print "(Bei Dauerbelastung droht Gefahr fuer den Motor!)"
End If
Text = "Bild von A. Schierwagen, GNU-Lizens - Wikipedia"
myFont = _LoadFont("C:\Windows\Fonts\Dauphinn.ttf", 15, "")
_Font myFont
'Neue Farbe setzen, dunkelgelb
Color _RGB32(255, 165, 0), _RGB32(0, 0, 0)
'Spalte - Zeile (Umgekehrt wie bei Locate)
_PrintString (360, 340), Text
'Farbe und Schrift zuruecksetzen
Color _RGB32(255), _RGB32(0, 0, 0)
_Font 16
_FreeFont myFont
End
It's an animated gif. Is there a way to get the animation? I couldn't find anything - or didn't understand it.