|
-
Aug 2nd, 2007, 12:23 AM
#1
Thread Starter
Lively Member
[2005] Saving Custom Colors
I have a colordialog box that I save the color last chosen using property bindings and My.Settings. My issue is that if they select and/or add a custom color, it doesnt remember the color added when I reload the program.
-
Aug 2nd, 2007, 02:05 AM
#2
Re: [2005] Saving Custom Colors
Are you reading/loading the custom color from your saved settings?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2007, 02:14 AM
#3
Re: [2005] Saving Custom Colors
You're either not loading the Color or not saving it because I just tested it and it worked perfectly. I started a new project, created a setting of type Color named "Colour", added a Panel and a Button to the form and then added this code:
vb.net Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Panel1.BackColor = My.Settings.Colour
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using dialogue As New ColorDialog
If dialogue.ShowDialog() = Windows.Forms.DialogResult.OK Then
My.Settings.Colour = dialogue.Color
Me.Panel1.BackColor = dialogue.Color
End If
End Using
End Sub
Everything worked exactly as it should, whether I chose a standard or custom colour.
-
Aug 8th, 2007, 10:33 PM
#4
Thread Starter
Lively Member
Re: [2005] Saving Custom Colors
I think you misunderstood my issue. The contol remembers the color. However the color dialog box does not remember the custom color. So if the user clicks on the color dialog box, his custom color cannot be selected by default because it is not there.
-
Aug 8th, 2007, 11:19 PM
#5
Re: [2005] Saving Custom Colors
Ah, I see. You are quite correct that the ColorDialog doesn't "remember" the custom colours. If you want that functionality then it's up to you to provide it. The ColorDialog has a CustomColors property that you can set before it's displayed and get after it's dismissed. If you want to save the custom colours and display them to the user in future then it's up to you to use that property and persist the colour values between sessions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|