How to add floating image like ASP.NET

Posted by: gw.noh on 26 July 2021, 1:52 pm EST

  • Posted 26 July 2021, 1:52 pm EST

    I need to add float image, not a cell value image.

    In ASP.NET DOcumentation, it will be possible

    FarPoint.Web.Spread.SpreadImage image = new FarPoint.Web.Spread.SpreadImage();

    image.CanMove = true;

    image.CanSelect = true;

    image.ImageUrl = “fplogo.png”;

    image.Width = 200;

    image.Height = 150;

    image.Left = 50;

    image.Top = 50;

    FpSpread1.ActiveSheetView.Images.Add(image);

    But in Winforms, just show add image at cell value.

    How to floating image?

  • Posted 26 July 2021, 5:00 pm EST

    Hi,

    You can add a Picture in a Shape object and then add that Shape anywhere on the sheet.

    Please refer the documentation for this:

    https://www.grapecity.com/spreadnet/docs/v14/online-win/spwin-shape-picts.html

    Here’s a code snippet for the same:

    var shape = new RectangleShape();
    shape.BackgroundImage = new FarPoint.Win.Picture(Image.FromFile(@"Images\logo.png"));
    shape.CanMove = Moving.HorizontalAndVertical;
    shape.Selectable = true;
    shape.Width = 200;
    shape.Height = 150;
    shape.Left = 50;
    shape.Top = 50;
    fpSpread1.ActiveSheet.AddShape(shape);
    

    Regards,

    Jitender

  • Posted 26 July 2021, 6:07 pm EST

    Thank you for your answer.

    If more questions by reply, how do I move this Shape(Image) to Row(Cell) to Row?

    If I erase some rows, I have to put the image up.

  • Posted 26 July 2021, 6:42 pm EST

    I think you are referring to the fact that the Shape (Image) size is reduced if one or more of the rows under the Shape is removed.

    You can set the DynamicSize property of the Shape to false so that its size is not changed when row/column is moved/removed.

    You can also get any shape using the GetShape method of SheetView. You would need to set the Name property of the Shape first.

    After you have the Shape object you can move it around anywhere you want.

    Let me know if you meant something else.

    Regards,

    Jitender

  • Posted 26 July 2021, 6:46 pm EST

    No, it’s not about the size. I want to move the image in cell or row units.

    Please let me know the sample code or reference link for this.

  • Posted 26 July 2021, 9:28 pm EST

    Please refer the attached sample which demonstrates how you can move a Shape in row/column units.

    FloatingImage.zip

    Regards,

    Jitender

  • Posted 27 July 2021, 11:03 am EST

    It’s a bit unfortunate because it’s pixel shift, but it’ll help a lot.

    Thank you.

Need extra support?

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

Learn More

Forum Channels