473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to save Back color in windows form application

I wrote this code behind a button
Expand|Select|Wrap|Line Numbers
  1. "
  2. colordialog.showdialog();
  3. File.WriteAllText("dlg.txt",this.BackColor.Name);
  4. "
  5. And I wrote this code in Form Load as well
  6. "
  7. this.BackColor = Color.FromName(File.ReadAllText("dlg.txt"));
  8. "
but I got an error and I dont know what is this... Any one knows "Control does not support transparent background colors"
Sep 28 '12 #1
2 3870
Color bgColor = this.BackGroundColor;
Oct 16 '12 #2
rupali
25
Hi kamalmahdavi,

You can try using RGB color as follows:
on button click
Expand|Select|Wrap|Line Numbers
  1.  colordialog.ShowDialog();
  2. File.WriteAllText("dlg.txt", colordialog.Color.ToArgb().ToString());
  3. this.BackColor = Color.FromArgb(colordialog.Color.ToArgb());
  4.  
and on form load
Expand|Select|Wrap|Line Numbers
  1. if (File.Exists("dlg.txt"))
  2. {
  3.     int nARGB = 0;
  4.     int.TryParse(File.ReadAllText("dlg.txt"), out nARGB);
  5.     this.BackColor = Color.FromArgb(nARGB); 
  6. }
Oct 18 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David | last post by:
So I'm a new user to Visual Studio .NET. I'm having a problem with an initial setup of a Windows Form Application for a Visual C++ Project. The Windows Form Application (.NET) template is not...
0
by: forge | last post by:
Installing Merge Modules from C# Windows Form Application (not using a setup and deployment project) Hi, Currently, we have an InstallShield project that creates a setup.exe that only...
1
by: Dean R. Henderson | last post by:
I have a Windows library that I bind into a Windows Form application and into an ASP.NET Web Application. I have a procedure in the library that executes a DTS Package. I have also used...
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
4
by: Dennis C. Drumm | last post by:
I've noticed that using Console.WriteLine statements to debug a Windows Forms Application will sometimes write output to the VS 2005 Output window and sometimes it doesn't. I know that...
3
by: Henry Seymour | last post by:
I've developed a .Net Windows Form application and used the Click-Once Deployment. In that application I would like to allow the user a click-once method of uninstalling it. I do not find an...
1
by: Dave | last post by:
Hello all, I have an application that is accessing files from a mapped drive. I have full access to the share that is mapped and from explorer can delete files as I need. My application needs to...
0
by: querry | last post by:
Hi all, I am developing a Windows form Application in VC++.NET using the Visual Studio 2005 installed on Windows Server 2003. The UI part of the project is almost complete. I am now looking forward...
2
by: ashkan0021 | last post by:
hi, i have a solution in C#.Net that includes 2 project and ASP.net & A Windows form application project, i want to open some pages of my asp.net project in my windows application, i'd be realy...
5
by: Henrik Söderber | last post by:
Hi! I use C# 4.0 to build a windows form application. I have a Windows Forms Timer that should tick every second. In every tick I do some work (get GPS position, update a map, save to a local DB...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.