Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exercise with picture and text
#1
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

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

[Image: Bild-mit-Text2024-06-13.jpg]

It's an animated gif. Is there a way to get the animation? I couldn't find anything - or didn't understand it.  Rolleyes
Reply


Messages In This Thread
Exercise with picture and text - by Kernelpanic - 06-13-2024, 04:16 PM
RE: Exercise with picture and text - by bplus - 06-13-2024, 08:17 PM
RE: Exercise with picture and text - by bplus - 06-13-2024, 09:19 PM
RE: Exercise with picture and text - by bplus - 06-13-2024, 10:24 PM
RE: Exercise with picture and text - by SMcNeill - 06-14-2024, 10:00 PM



Users browsing this thread: 3 Guest(s)