in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Disabled style

Last post 10-10-2007 12:40 AM by C1_DaveT. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-06-2007 3:39 PM

    • hukhuk
    • Not Ranked
    • Joined on 03-20-2006
    • Posts 5

    Disabled style

     Hi all,

    is there  a chance to show the grid columns to be greyed when the control is set to be disabled? It looks very ugly, when all controls (original  .NET textboxes, labels, ...) are greyed out but the C1 controls are not greyed. What am I doing wrong? All the controls lay on a Tab-Control which gets disabled (when no customer is selected outside the TAB)

    thanks in advance, Harry 

    Filed under:
  • 10-08-2007 12:47 PM In reply to

    • C1_GregL
    • Top 10 Contributor
    • Joined on 06-11-2007
    • Pittsburgh PA
    • Posts 431

    Re: Disabled style

    No, but you can apply your own style however you like.  Try code like shown below to create a disabled style that looks similar to the standard disabled controls.

    Private disabledStyle As C1.Win.C1FlexGrid.CellStyle

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      
    disabledStyle = Me.C1FlexGrid1.Styles.Add("Disabled")
       disabledStyle.BackColor = Color.FromArgb(
    CType(240, Byte), CType(240, Byte), CType(240, Byte))
       disabledStyle.ForeColor = Color.DarkGray
       disabledStyle.Border.Style = BorderStyleEnum.Flat
       disabledStyle.Border.Color = Color.LightGray
    End Sub

    Private Sub C1FlexGrid1_EnabledChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1FlexGrid1.EnabledChanged
      
    If Not C1FlexGrid1.Enabled Then
         
    C1FlexGrid1.VisualStyle = VisualStyle.Custom
         
    Dim rng As CellRange
          rng = C1FlexGrid1.GetCellRange(1, 1, C1FlexGrid1.Rows.Count - 1, C1FlexGrid1.Cols.Count - 1)
          rng.Style = disabledStyle
      
    Else
         
    ..apply your original style
      
    End If
    End Sub

     

    Regards,
    Greg L

    Filed under: ,
  • 10-10-2007 12:40 AM In reply to

    Re: Disabled style

    Hi,
     
    You may define a style for this. The code below is an example:
     

    Dim cs As CellStyle = fg.Styles.Add("new")

    cs.BackColor = Color.LightGray

    Dim rg As CellRange = fg.GetCellRange(1, 0, fg.Rows.Count - 1, fg.Cols.Count - 1)

    rg.Style = cs

    fg.Enabled = False

     

    Regards,

    -Dave

    <hukhuk> wrote in message news:198900@10.0.1.98...

     Hi all,

    is there  a chance to show the grid columns to be greyed when the control is set to be disabled? It looks very ugly, when all controls (original  .NET textboxes, labels, ...) are greyed out but the C1 controls are not greyed. What am I doing wrong? All the controls lay on a Tab-Control which gets disabled (when no customer is selected outside the TAB)

    thanks in advance, Harry 



    http://helpcentral.componentone.com/cs/forums/p/73270/198900.aspx#198900

Page 1 of 1 (3 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.