Z
Zach
Using the code below I can change the screen color.
How can I ascertain the colors as they are before changung them, so I can
change the colors back to what they were upon leaving the application?
Zach.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Vocab
{
public partial class ScrColor1 : Form
{
const int COLOR_DESKTOP = 1;
[DllImport("user32.dll")]
public static extern bool SetSysColors(int cElements, int[]
lpaElements, uint[] lpaRgbValues);
int[] aiElements = {COLOR_DESKTOP};
uint RGB(byte byRed, byte byGreen, byte byBlue)
{
uint res = byBlue;
res = res << 8;
res += byGreen;
res = res << 8;
res += byRed;
return res;
}
public ScrColor1()
{
InitializeComponent();
uint[] aColors = { RGB(100,50,150) };
SetSysColors(1, aiElements, aColors);
}
}
}
How can I ascertain the colors as they are before changung them, so I can
change the colors back to what they were upon leaving the application?
Zach.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Vocab
{
public partial class ScrColor1 : Form
{
const int COLOR_DESKTOP = 1;
[DllImport("user32.dll")]
public static extern bool SetSysColors(int cElements, int[]
lpaElements, uint[] lpaRgbValues);
int[] aiElements = {COLOR_DESKTOP};
uint RGB(byte byRed, byte byGreen, byte byBlue)
{
uint res = byBlue;
res = res << 8;
res += byGreen;
res = res << 8;
res += byRed;
return res;
}
public ScrColor1()
{
InitializeComponent();
uint[] aColors = { RGB(100,50,150) };
SetSysColors(1, aiElements, aColors);
}
}
}