Buttoncell without border + selectrow

Posted by: fsegui on 27 October 2020, 10:10 pm EST

  • Posted 27 October 2020, 10:10 pm EST

    Hello,
    I'm currently migrating an app from Spread OCX (ss8) to Spread .NET (v13).
    I'm facing two issues:
    - how can i select a row programmatically and when displaying the fpspread, the row appears already selected?
    - for buttoncell, we apply an image on it and I got a difference in rendering.

    In the picture above, you can see how it renders actually and the result with Spread.NET. How can I remove the button borders? Is there a flat style?
    Here is the code used:
     Dim btn As FarPoint.Win.Spread.CellType.ButtonCellType = New FarPoint.Win.Spread.CellType.ButtonCellType()
    btn.TextAlign = FarPoint.Win.ButtonTextAlign.TextBottomPictTop
    btn.UseVisualStyleBackColor = False
    btn.BackgroundStyle = FarPoint.Win.BackStyle.Default
    btn.ButtonColor = Color.White
    btn.ButtonColor2 = Color.White
    btn.DarkColor = Color.White
    btn.LightColor = Color.White

    btn.ShadowSize = 0

    cell.CellType = btn
  • Replied 29 October 2020, 1:14 am EST

    Hello,

    >> how can i select a row programmatically and when displaying the fpspread, the row appears already selected?
    You can add the selection using the following line of code:
    fpSpread1.ActiveSheet.AddSelection(0, 0, 1, fpSpread1.ActiveSheet.Columns.Count - 1);

    If my understanding is incorrect, could you please explain in detail.
    I am unable to reproduce the issue at my end. Please refer to the attached image. Could you please share the stripped down sample so that I can replicate the issue at my end.

    Thanks,
    Mohit

  • Replied 29 October 2020, 4:15 am EST

    Hello,
    It's working for the row selection. Thanks.

    For the render issue, the spread is composed of 2 rows: first one with cells of buttoncelltype, second one with cells of textcelltype (static ones).
    I apply an image to the button cell and a white color.

    With SS8, the button cell do not have any borders whereas with Spread.NET 13, border+shadow appears. The buttoncell fills completely the cell.

    Here is another picture with comments :


    I could use imagecelltype, but background would not be white when user click on it.
  • Replied 29 October 2020, 4:23 am EST

    I'll try to make a short sample.
  • Replied 29 October 2020, 7:02 pm EST

    Hello,
    I've updated one of your sample (Spread.celltypes). I've added the picture to the buttoncell.
    Moreover, I've removed the focus indicator but I still have a blue border when user move hover the cell.Spread.CellTypes.zip
  • Marked as Answer

    Replied 1 November 2020, 10:30 pm EST

    Hi Florent,

    Thank you for sharing the sample.

    This is the default behavior of the button cell when it is in edit mode and we can't directly hide its border on MouseHover.
    Therefore as a workaround, we can stop the editing for the cell using the Spread's StopCellEditing method inside ButtonClicked event as follows:

    Private Sub Spread_ButtonClicked(sender As Object, e As EditorNotifyEventArgs)
    If e.Column = introductionSheet.ColumnCount - 1 Then
    introductionSheet.Cells(e.Row, 6).Value = 10 + Convert.ToInt32(introductionSheet.Cells(e.Row, 6).Value)
    spread.StopCellEditing()
    End If
    End Sub

    Please refer the same from the attached modified sample. (see Spread.CellTypes_Mod.zip)

    Regards,

    Kartik
    Spread.CellTypes_Mod.zip
Need extra support?

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

Learn More

Forum Channels