Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
ConsoleGraph - ConsoleGraph Guida Sorgente

ConsoleGraph

Sommario | Admin | Forum | Bugs | Todo | Files

Avatar
Thejuster (Admin)
Guru^2


Messaggi: 2298
Iscritto: 04/05/2008

Segnala al moderatore
Postato alle 17:01
Domenica, 15/04/2018
ConsoleGraph č una libreria Cross-Platform .net Core
che consente l'implementazione grafica su terminale di controlli gestisti come Button, TextBox, Label Etc.


Impostazione base dell'applicazione

Codice sorgente

WindowManager.Title("Example App"); WindowManager.SetupWindow(); WindowManager.UpdateWindow(100, 40); //Larghezza, Altezza in char




----------------------------


Versione 1.0.2
Implementazione del MessageBox di tipo Alert

Codice sorgente

WindowManager.SetupWindow(); new Alert("Messaggio di Avviso!", null); //Contenitore Padre WindowManager.EndWindow();



ScreenShoot
https://s9.postimg.cc/4ticw53cf/Cattura.png


Costruzione di un controllo manuale:

Codice sorgente - presumibilmente VB.NET

  1. Button bt = new Button(X,Y,"Testo","ID",this);
  2.  
  3. //Assegnazione di un evento
  4.  
  5. bt.Action = delegate() { Exit(); }
  6.  
  7.  
  8. /// <summary xml:lang="it">
  9. ///  Chisura dell'applicazione
  10. /// </summary>
  11. /// <summary xml:lang="en">
  12. /// Application Exit
  13. /// </summary>
  14. public void Exit()
  15.         {
  16.             Exit = true;
  17.             if (Parent != null)
  18.                 Parent.Draw();
  19.         }



La classe button č basa sulla classe astratta Control

Codice sorgente

  public class Button : Control     { /// <summary xml:lang="it">         /// Crea un controllo di tipo Pulsante         /// </summary>         /// <summary xml:lang="en">         /// Create a button control         /// </summary>         /// <param name="x">X</param>         /// <param name="y">Y</param>         /// <param name="text">Button Text</param>         /// <param name="iD">Control ID</param>         /// <param name="parentWindow">Parent Window</param>         public Button(int x, int y, String text, String iD, Window parentWindow) : base(x, y, 1, text.Count() + 2, parentWindow, iD)         {             Text = text;             BackgroundColour = parentWindow.BackgroundColour;             Selectable = true;         }      }






Ultima modifica effettuata da Thejuster il 15/04/2018 alle 17:02


https://mire.forumfree.it/ - Mire Engine
C# UI Designer
PM Quote
Avatar
Thejuster (Admin)
Guru^2


Messaggi: 2298
Iscritto: 04/05/2008

Segnala al moderatore
Postato alle 9:37
Lunedė, 11/11/2019
Aggiunto gli eventi ai relativi controlli.

https://i.postimg.cc/rsczYRXt/Immagine.png

Un esempio č:

Codice sorgente - presumibilmente C++

  1. Button oneBtn = new Button(2, 2, "Button One", "oneBtn", this);
  2. oneBtn.ButtonPressed += new Button.OnButtonPressed(oneBtn_ButtonPressed);
  3.  
  4.  
  5.  
  6.  void oneBtn_ButtonPressed()
  7.         {
  8.             new Alert("You Clicked Button One", this, ConsoleColor.White);
  9.         }




Aggiunto anche gli eventi con argomenti relativi a determinati controlli.
Un esempio per la TextArea

https://i.postimg.cc/QtqWDJqq/Immagine.png


Codice sorgente - presumibilmente C++

  1. var textArea = new TextArea(17, 2, 60, 6, "txtArea", this);
  2. textArea.BackgroundColour = ConsoleColor.DarkGray;
  3. textArea.TextChanged += new TextArea.OnTextChanged(textArea_TextChanged);
  4.  
  5.  
  6. void textArea_TextChanged(Input Sender, TextChangedEventArgs e)
  7.         {
  8.             if (e.Text == "hello")
  9.             {          
  10.                 new Alert("The Text area whit id: \"" + e.ID + "\" Contains " + e.Text + "!",this, ConsoleColor.White);
  11.             }
  12.         }



https://mire.forumfree.it/ - Mire Engine
C# UI Designer
PM Quote