UI design for crossword.

Posted by: ashupune on 8 September 2017, 3:10 pm EST

  • Posted 8 September 2017, 3:10 pm EST

    Any pointers/suggestions to design UI for crossword application  on winform ? To be specific :  Some cells need to have a number (preferabely in the corner ) and the text inside.Tried using cellnote and tooltiptext but that is not exactly what I want as they do not remain inside the cell and overwrites some cells.

  • Replied 8 September 2017, 3:10 pm EST

    Hi,

    You can use a RectangleShape.  If you set CanRenderText = true and BackColor = Color.Transparent, then the text will be drawn over the cells where you place the shape and the cells will show through behind the text.  You can put the number in the shape Text, set the font you want, set Locked = true (so the user can't move or select it), then position it in the top left of the cell where you want the number to show.  You can get rid of the rectangle by setting ShapeOutlineThickness = 0, and only the number will show overlaid on top of the corner of the cell.

    Hope that helps!

  • Replied 8 September 2017, 3:10 pm EST

    Thanks Sean for the quick help. Will try this and get back.
  • Replied 8 September 2017, 3:10 pm EST

    Seems to be working fine except could not achieve this : then position it in the top left of the cell .  Confused how to achieve this. Tried top,location properties,  but does not seems to be working. Any code ?
  • Replied 8 September 2017, 3:10 pm EST

    ashuPune,

    You can find the shape's location by summing the widths and heights of the previous columns and rows. You can set the shape's location by setting the Location property or by settings the Left/Top properties. For example, the following code creates a shape located at the left top corner of cell with coordinates (row, column)...

    <blockquote>

    SheetView sheet = fpSpread1.ActiveSheet;

    int x = 0;
    int y = 0;
    for (int i = 0; i < column; i++)
    {
        x += sheet.GetColumnWidth(i);
    }
    for (int j = 0; j < row; j++)
    {
        y += sheet.GetRowHeight(j);
    }

    RectangleShape shape = new RectangleShape();
    shape.Location = new Point(x, y);
    ... // set other shape properties
    sheet.AddShape(shape);

    </blockquote>

    Or you can use the overload of the AddShape that takes cell coordinates. This overload finds and sets the shape's location based on the cell's location. For example...

    <blockquote>

    SheetView sheet = fpSpread1.ActiveSheet;
    RectangleShape shape = new RectangleShape();
    ... // set other shape properties
    sheet.AddShape(shape, row, column);

    </blockquote>
Need extra support?

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

Learn More

Forum Channels