RemoveRegionByID doesn't clear the region from the control

Discussions about document viewing.
Post Reply
guilli
Posts: 3
Joined: Tue Nov 24, 2015 4:55 pm

RemoveRegionByID doesn't clear the region from the control

Post by guilli » Tue Nov 24, 2015 5:13 pm

Hi,

Removing a region from the GdViewer by its ID (using the method GdViewer.RemoveRegionByID) removes it from memory, but doesn't clear it from the screen. Is there another method I should call to refresh the control?

Thank you,
- GD

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: RemoveRegionByID doesn't clear the region from the contr

Post by Loïc » Tue Nov 24, 2015 7:40 pm

Hello,

All is working fine from my end.

Have you tried with the latest release?

if the problem persists with it, could you share a code snippet reproducing the issue?

Kind regards,

Loïc

guilli
Posts: 3
Joined: Tue Nov 24, 2015 4:55 pm

Re: RemoveRegionByID doesn't clear the region from the contr

Post by guilli » Tue Nov 24, 2015 8:52 pm

Good day,

I still have the same problem with the latest version (downloaded from https://www.gdpicture.com/download-gdpicture).

I work in a WPF project in which I have a MainWindow. For the sake of testing, I only put a GdViewer in this Window.

In the Window.Loaded event, I wrote this code :

Code: Select all

using (GdPictureImaging gdp = new GdPictureImaging())
{
    int imageId = gdp.CreateGdPictureImageFromFile(STR_PathToImage);
    double imageHeight = gdp.GetHeightInches(imageId);
    double imageWidth = gdp.GetWidthInches(imageId);
    Rect region = new Rect(imageWidth / 2 - imageWidth * .05,
                           imageHeight / 2 - imageHeight * .05,
                           imageWidth * .1, imageHeight * .1);

    GdViewer.DisplayFromGdPictureImage(imageId);
    int regionId = GdViewer.AddRegion("test", region.X, region.Y, region.Width, region.Height,
                   Colors.Red, GdPicture11.WPF.GdViewer.RegionFillMode.Normal);
    var result = GdViewer.RemoveRegionByID(regionId);
}
The value of result is GdPictureStatus.OK.

The problem I encounter is that the region will still be there. If I move the image, the region will stay on the same place in the window (it will not move with the image). I have the same problem with GdViewer.RemoveRegionByName, but GdViewer.RemoveAllRegions works flawlessly.

Let me know if I can give you any other information.

Thank you,
- GD

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: RemoveRegionByID doesn't clear the region from the contr

Post by Loïc » Thu Nov 26, 2015 1:40 pm

Hello,

Thank you for the snippet. The problem has been resolved for the next minor release that will be published today.

With best regards,

Loïc

guilli
Posts: 3
Joined: Tue Nov 24, 2015 4:55 pm

Re: RemoveRegionByID doesn't clear the region from the contr

Post by guilli » Thu Nov 26, 2015 4:29 pm

Thank you for your support!

Have a nice day,
- GD

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests