Use Spread like a listbox

  • tosch 2 weeks, 2 days ago

    I want to use Spread like a Listbox.
    I have five columns, text in the first one and some icons in the other columns.
    OperationMode is set to Rowmode.
    But I want the whole row to be selected with a background color and no border around the current cell.
    See attached image I created.
    How can I achieve this?

    Thomas

    Attachments:
    You must be logged in to view attched files.
  • 113p
    Reeva113p 2 weeks, 1 day ago

    Hello,

    For this with OperationMode set to rowMode, you need to set FocusRenderer to null which will remove border around selection as given below:-

    fpSpread1.ActiveSheet.OperationMode = FarPoint.Win.Spread.OperationMode.RowMode;
                fpSpread1.FocusRenderer = null;

    Hope it helps.

    Thanks,
    Reeva

  • tosch 2 weeks, 1 day ago

    Reeva,
    the focus around the current cell is not visible now, that’s good.
    But I would still like to see which row is current and have the whole row highlighted no matter on which cell I click.

    Thomas

  • 113p
    Reeva113p 2 weeks, 1 day ago

    Hello,

    It seems that you would like to paint the active cell differently. Hence, you would need to create an implementation of an IFocusIndicatorRenderer to attach to the Spread as given below:-

    private void Form1_Load(object sender, EventArgs e)
            {
                fpSpread1.ActiveSheet.OperationMode = FarPoint.Win.Spread.OperationMode.RowMode;
                fpSpread1.FocusRenderer = new myrenderer();
                //fpSpread1.ActiveSheet.SelectionBackColor = Color.Red;
                fpSpread1.Sheets[0].SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors;
            }
        }
        public class myrenderer : FarPoint.Win.Spread.IFocusIndicatorRenderer
        {
            public void Paint(Graphics g, int X, int y, int width, int height, bool left, bool top, bool right, bool bottom)
            {
                g.FillRectangle(new SolidBrush(Color.SkyBlue), new System.Drawing.RectangleF(X, y, width – 1, height – 1));
            }
        }

    Hope it helps.

    Thanks,
    Reeva

  • tosch 2 weeks, 1 day ago

    Thanks, this pointed me in the right direction.
    I’m using this code instead so the text in the cell is not ‘hidden’

    Dim semiTransBrush As New SolidBrush(Color.FromArgb(128, 135, 206, 235))   ’87CEEB
            g.CompositingQuality = Drawing2D.CompositingQuality.GammaCorrected
            g.FillRectangle(semiTransBrush, New System.Drawing.RectangleF(x, y, width – 1, height – 1))

    Thomas

  • 113p
    Reeva113p 1 week, 4 days ago

    Hello,

    We are glad to know that your issue has been resolved.

    Thanks,
    Reeva

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to create new topics.