Zum Inhalt springen
View in the app

A better way to browse. Learn more.

#T/N/X/T

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Metatrader. Colorcodes als rgb mit Variablen?

Geschrieben

Hallo liebe Mit-Coder,

 

ich habe mal wieder eine Dummy-Frage. Ich möchte die "Color" in Metatrader am liebsten per rgb über Variablen definieren und nicht als Webcode oder Hexcode. Allerdings schluckt das der Kompiler nicht so wie ich mir das vorstelle. Weiss jemand wie man das quoten muss?

 

Bsp.:

 

int r,g,b;

 

color cColor=C'200,200,200'; //----> das funktioniert natürlich

 

 

color cColor="C''" + r + "," + g + "," + b + "''"; //----> ergibt eine Fehlermeldung

 

 

 

bin wie immer für Tipps und Ratschläge dankbar

 

wingman

Featured Replies

Geschrieben

Der Zusammenbau einer Konstante funktioniert nicht, da die vollständige Konstante selber das Atom für den Parser ist. Wegen der internen Farb-Darstellung geht:

color C = ((b <<  8) + g) << 8 + r   // oder gleichwertig:
color C =   b << 16  + g  << 8 + r

Geschrieben
  • Autor
color C = ((b <<  8) + g) << 8 + r   // oder gleichwertig:
color C =   b << 16  + g  << 8 + r

 

 

Alles klar. Da wäre ich so schnell nicht drauf gekommen. Meine C++ Kenntniss sind leider etwas eingerostet. :blink:

 

Vielen Dank :blink:

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

Account

Navigation

Suche

Suche

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.