Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2006, 10:12 AM
Authorized User
 
Join Date: Feb 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using system color vbGreyText

Hi

I have a legacy app that uses a Farpoint spreadsheet control (Ver 2.5) to display a number of "Hold Reasons". Of these lines some are "Disabled" and the fore color is coded to be vbGreyText.

The problem is when the .forecolor is set it is a different value to vbGreyText.
ie
Before : forecolor = 0, vbGrayText = -2147483631

Code : sprd.forecolor = vbgreytext

After : forecolor = 10070188, vbGrayText = -2147483631

At a later stage in the application the forecolor is used to check if any operation can be done on the row and if is equals vbGrayText no operation can be performed. As the two values are different it does allow operations.

Anybody any ideas why the values are different?

Thanks in advance

Daz

 
Old November 29th, 2006, 03:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

vbgraytext is a system color, while the property forecolor seems that returns a RGB color (in your case 0x99A8AC).
try converting vbgraytext in the real RGB color using the GetSysColor API:

Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long

if sprd.forecolor = GetSysColor(vbGrayText And &hFFF)

to see if that works.
But sometimes it doesn't, I saw already controls that do not set exactly the color you ask for, like the MSFlexGrid. This is why I never use the color to check program settings, but I use a local internal data.
 
Old November 30th, 2006, 06:33 AM
Authorized User
 
Join Date: Feb 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,

May take the sledge hammer approach and hard code it to and check for vbRed (not my choice of approach but the easiest fix)

I hope there is only one version of red!!!

Thanks again

Daz






Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq and namespaces System and System.Xml roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 July 4th, 2008 01:15 PM
system.stackoverflowexception in system.windows.fo scheidel21 Pro VB.NET 2002/2003 2 May 18th, 2007 12:40 AM
Insert System date and System Time -Form _TextBox cnkumar74 VB How-To 14 February 14th, 2007 10:52 AM
Accessing System Resources of a Remote System harsh_hot J2EE 0 February 9th, 2006 01:13 AM
Casting System::Object __gc * to System.Double[] nepsat Visual C++ 3 November 19th, 2005 12:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.