---
title: "Problem med bakgrundsfärg i Console-program"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/107706-problem-med-bakgrundsfärg-i-console-program"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "Vimp"
published: "2004-07-20T14:05:39.000Z"
updated: "2004-07-20T14:05:39.000Z"
replies: 0
views: 192
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/107706-problem-med-bakgrundsfärg-i-console-program"
---

# Problem med bakgrundsfärg i Console-program

## #1 — Vimp, 2004-07-20T14:05Z

Jag sitter och leker lite med C# 2.0 nu och försöker ändra bakgrundsfärgen i consolen.
Jag lyckas få en annan bakgrundsfärg bakom texten, men inte i hela consolen.
Någon som har en lösning?

Min nuvarande kod:

```
#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

#endregion

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.BackgroundColor = ConsoleColor.DarkBlue;
            Console.ForegroundColor = ConsoleColor.White;
            Console.Title = "Testar att ändra titel...";

            Console.WriteLine("Text 1:");
            string String1 = System.Console.ReadLine();

            Console.WriteLine("Text 2:");
            string String2 = System.Console.ReadLine();

            StringBuilder strString = new StringBuilder();
            strString.Append(String1);
            strString.Append(String2);

            Console.WriteLine("Första strängen: {0}", String1);
            Console.WriteLine("Andra strängen: {0}", String2);
            Console.WriteLine("--------------------------------------------------");
            Console.WriteLine("Båda ihoppsatta: {0}", strString);

            Console.ReadLine();

        }
    }
}
```

Permalänk: https://www.webforum.nu/p/107706

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/107706-problem-med-bakgrundsfärg-i-console-program
