question

Metaconta-8190 avatar image
0 Votes"
Metaconta-8190 asked Bruce-SqlWork answered

window settings

Hello:

I have the code in C# and I want to adapt it in F#. What it does is configure the window in the console, enter a text and indicate its coordinate.

Some help?

C# code:

 using System;
    
 namespace Configuracion_ventanas_Consola_CS
 {
     internal class Program
     {
         static void Main(string[] args)
         {
             #region window settings .
             // window title .
             Console.Title = "window title ";
    
             // Window size, x, y o, width and height. 
             const byte ancho = 80;
             const byte alto = 20;
             Console.SetWindowSize(ancho, alto);
    
             // Background color.
             Console.BackgroundColor = ConsoleColor.Black;
    
             // Color of the letters. 
             Console.ForegroundColor = ConsoleColor.Green;
    
             // Clear screen and leave everything in background color. 
             Console.Clear();
    
             // Cursor visible. 
             Console.CursorVisible = false;
             #endregion
    
             // Cursor position. 
             int anchoX = 20;
             int altoY = 8;
             Console.SetCursorPosition(anchoX, altoY);
    
             // Show texts. 
             Console.WriteLine("Estás leyendo este texto en pantalla. C#");
    
             // Press any key to exit. 
             Console.ReadKey();
         }
     }
 }

A cordial greeting.

dotnet-fsharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

simple convert:

 module Configuracion_ventanas_Consola_CS
 open System
    
 // window title .
 Console.Title = "window title "
    
 // Window size, x, y o, width and height. 
 let ancho = 80
 let alto = 20
 Console.SetWindowSize(ancho, alto)
    
 // Background color.
 Console.BackgroundColor = ConsoleColor.Black
    
 // Color of the letters. 
 Console.ForegroundColor = ConsoleColor.Green
    
 // Clear screen and leave everything in background color. 
 Console.Clear()
    
 // Cursor visible. 
 Console.CursorVisible = false
    
 // Cursor position. 
 let anchoX = 20
 let altoY = 8
 Console.SetCursorPosition(anchoX, altoY)
    
 // Show texts. 
 Console.WriteLine("Estás leyendo este texto en pantalla. C#")
    
 // Press any key to exit. 
 Console.ReadKey()
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.