Windows Develop Bookmark and Share   
 index > Windows Forms General > Problem with applying non primary colors
 

Problem with applying non primary colors

Hi,

When i read the color, for primary colors it is showing as color[red or blue or yellow etc]
when i read it for non primary colors, it is showing as color[A=255, R=64, G=128, B=128] etc.

Why am i not getting the color names for non primary colors?

I want to read the color in one place and apply the same to a row.
For primary colors, i am able to do it. for non primary colors it is failing.
this is my code:


Dim curr_row As Integer = dgvSchedules.CurrentRow.Index
        Me.ColorDialogpalette.ShowDialog()
        dgvSchedules.RowHeadersDefaultCellStyle.SelectionBackColor = Me.ColorDialogpalette.Color

        If m_selectedrow >= 0 Then
            dgvSchedules.Rows(m_selectedrow).DefaultCellStyle = Nothing
        End If

        m_selectedrow = dgvSchedules.CurrentRow.Index
        dgvSchedules.CurrentRow.DefaultCellStyle.BackColor = Me.ColorDialogpalette.Color
       
        tripid_color = dgvSchedules.Item("Trip_ID", m_selectedrow).Value.ToString()
        rowcolor = dgvSchedules.Rows(m_selectedrow).DefaultCellStyle.BackColor.ToString()
      

        Call color_datatable(tripid_color, rowcolor)

Does anyone have a solution for this?

Thanks in Advance

rowter  Friday, October 02, 2009 2:09 PM
Windows supports 256 x 256 x 256 = 16 million individual colors.  Clearly, not all of these have a name.  Avoid the naming problem by avoiding using a string.  Either use Color or convert back-and-forth from an integer with Color.FromArgb() and Color.ToArgb().

Hans Passant.
nobugz  Friday, October 02, 2009 2:16 PM
Windows supports 256 x 256 x 256 = 16 million individual colors.  Clearly, not all of these have a name.  Avoid the naming problem by avoiding using a string.  Either use Color or convert back-and-forth from an integer with Color.FromArgb() and Color.ToArgb().

Hans Passant.
nobugz  Friday, October 02, 2009 2:16 PM
Thanks. That worked.
rowter  Friday, October 02, 2009 3:42 PM

You can use google to search for other answers

Custom Search

More Threads

• display that xml document as a browser
• ListView.Items.Find using Invoke and Threads
• Small problem (MDI form, ToolStripContainer) but very urgent
• Problem with saving webpage displayed by C# 2005 WebBrowser control
• Populating a textbox on one form from another form
• Colorize subString in textbox
• Official Time Webservice
• Data Grid--to mark a row in different color
• Composite Custom Web Control and external Validator?
• FormClosingEvent has no CloseReason