Getting rid of active cell on almost read only form

Posted by: aslyon on 8 September 2017, 1:15 pm EST

  • Posted 8 September 2017, 1:15 pm EST

    I have a table that is locked/protected apart from a column containing a check box. The functionality I want is the whole row to be highlighted when the user clicks anywhere on that row, including the checkbox. I have tried to set the style of the table to select whole row, but where the user clicks always ends up with the activeCell contrast colour. Also, when the table is displayed initially, the top row is selected (although no activeCell is highlighted) which I don't want.


    I set the sheet with these parameters


    mySheet.OperationMode = FarPoint.Win.Spread.OperationMode.RowMode


    mySheet.SelectionBackColor = Color.AliceBlue


    mySheet.SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors


    mySheet.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.Single


    mySheet.SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row


    if I set mySheet.OperationMode = FarPoint.Win.Spread.OperationMode.SingleSelect I get the look that I want but then I loose the ability to check/uncheck the checkbox on each row. 


    How can I get rid of the highlight of activeCell and how can I avoid the top row being selected with my selectionBackColor when I open the form???


    Thanks for any help!

  • Replied 8 September 2017, 1:15 pm EST

    Hello,


    There has to be an active cell when starting the application with a Spread control and this is why you are seeing the first row as selected. You can move the active cell to a row off the visible Spread, or hide a row and make it active if you do not want to see a row selected initially. If you like to paint the active cell differently, you would need to create an implementation of an IFocusIndicatorRenderer to attach to the Spread.

     
    	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FpSpread1.Sheets(0).OperationMode = FarPoint.Win.Spread.OperationMode.RowMode
    FpSpread1.FocusRenderer = New myrenderer
    FpSpread1.Sheets(0).SelectionBackColor = Color.AliceBlue
    FpSpread1.Sheets(0).SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors
    End Sub

    Public Class
    myrenderer
    Implements FarPoint.Win.Spread.IFocusIndicatorRenderer

    Public Sub Paint(ByVal g As Graphics, ByVal X As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal left As Boolean, ByVal top As Boolean, ByVal right As Boolean, ByVal bottom As Boolean) Implements FarPoint.Win.Spread.IFocusIndicatorRenderer.Paint
    g.FillRectangle(New SolidBrush(Color.AliceBlue), New RectangleF(X, y, width - 1, height - 1))

    End Sub
    End Class
     
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels