This application is a text editor written in C# and Windows Forms as part of my college class final project in Fall 2016. Other projects for the final project included:
NOTE: This version is not currently being worked on, waiting on XAML Islands release for further update
// fill colors in color drop down list
foreach (System.Reflection.PropertyInfo prop in typeof(Color).GetProperties())
{
if (prop.PropertyType.FullName == "System.Drawing.Color")
{
colorList.Add(prop.Name);
}
}
// fill the drop down items list
foreach(string color in colorList)
{
colorStripDropDownButton.DropDownItems.Add(color);
}
// fill BackColor for each color in the DropDownItems list
for (int i = 0; i < colorStripDropDownButton.DropDownItems.Count; i++)
{
// Create KnownColor object
KnownColor selectedColor;
selectedColor = (KnownColor)System.Enum.Parse(typeof(KnownColor), colorList[i]); // parse to a KnownColor
colorStripDropDownButton.DropDownItems[i].BackColor = Color.FromKnownColor(selectedColor); // set the BackColor to its appropriate list item
// Set the text color depending on if the barkground is darker or lighter
// create Color object
Color col = Color.FromName(colorList[i]);
// 255,255,255 = White and 0,0,0 = Black
// Max sum of RGB values is 765 -> (255 + 255 + 255)
// Middle sum of RGB values is 382 -> (765/2)
// Color is considered darker if its <= 382
// Color is considered lighter if its > 382
sumRGB = ConvertToRGB(col); // get the color objects sum of the RGB value
if (sumRGB <= MIDDLE) // Darker Background
{
colorStripDropDownButton.DropDownItems[i].ForeColor = Color.White; // set to White text
}
else if (sumRGB > MIDDLE) // Lighter Background
{
colorStripDropDownButton.DropDownItems[i].ForeColor = Color.Black; // set to Black text
}
}
Requires Visual Studio 2017 or higher to run.
[Coming Soon]
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details