rahmen



  • Hi!

    ich hab folgendes programm geschrieben:

    #include <windows.h> 
    #include <iostream> 
    #include <string>
    #include <conio.h>
    using namespace std;
    #define r SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE), 9); cout<<c6;
    
    char c1=201, c2=205, c3=187, c4=200, c5=188, c6=186;
    void rahmen (int o_u, int laenge)
    {
    SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE), 9);
    	if (o_u==1) cout<<c1;
    		else cout<<c4;
    		for(int i=0;laenge>=i;i++){
    			cout<<c2;			
    		}
    	if (o_u==1) cout<<c3;
    		else cout<<c5;
    cout<<endl;
    }
    void tickingtext (string text, int wartezeit) 
    { 
    	for (int i=0;i<text.length();i++) 
    { 
    std::cout<<text.substr(i,1); 
    Sleep(wartezeit); 
    } 
    } 
    void FullScreen () 
    { 
        keybd_event ( VK_MENU , 0x38 , 0 , 0 ); 
        keybd_event ( VK_RETURN , 0x1c , 0 , 0 ); 
        keybd_event ( VK_RETURN , 0x1c , KEYEVENTF_KEYUP , 0 ); 
        keybd_event ( VK_MENU , 0x38 , KEYEVENTF_KEYUP , 0 ); 
    } 
    int main() {
    FullScreen ();
    rahmen (1, 34);
    r
    SetConsoleTextAttribute(::GetStdHandle(STD_OUTPUT_HANDLE), 11);
    string dertext="Hier steht ein text, das ist toll! ";
    tickingtext (dertext, 100);
    r
    cout<<endl;
    rahmen (2, 34);
    getch();
    return 1; 
    }
    

    Allerdings sieht das ziemlich blöd aus, wenn der zweite teil des rahmens
    erst nachdem der text ausgegeben wurde erscheint.
    Wer weiß wie man erst den Rahmen zeichnet, und den text dann dort hineinsetzt?

    Danke schonmal im voraus!



  • schau mal ins konsolenfaq

    unter "improved console" findest du, was du suchst.



  • Dieser Thread wurde von Moderator/in Gerard aus dem Forum C++ in das Forum DOS und Win32-Konsole verschoben.

    Im Zweifelsfall bitte auch folgende Hinweise beachten:
    C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?

    Dieses Posting wurde automatisch erzeugt.


Anmelden zum Antworten