Re-sizing of image in imageannotation

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

BlindMonk wrote at 2013-07-25 16:31:

I can display an oxyimage in a plotmodel using imageannotation.

There is a weird issue with the image zoom and resize. When I resize the window horizontally, horizontal axes changes values, which is fine, but the image also resizes, and the Y axis doesnt change. So I end with different height.

I tried to set both width and height, but then image is missing. Its a simple code. I am pasting below.
                byte[] b = new byte[160000];
                for (int i = 0; i < b.Length; i++) b[i] = 125;


                image = OxyImage.FromArgb(200, 200, b,96);

            
                model.Annotations.Add(new ImageAnnotation
                {
                    ImageSource = image,
                    X = new PlotLength(0, PlotLengthUnit.Data),
                    //Y = new PlotLength(0, PlotLengthUnit.Data),
                    Interpolate=false,
                    Width = new PlotLength(200, PlotLengthUnit.Data),

                    //Height = new PlotLength(200, PlotLengthUnit.Data),
                    //HorizontalAlignment = OxyPlot.HorizontalAlignment.Center,
                    //VerticalAlignment = OxyPlot.VerticalAlignment.Top

                });
Any tips are deeply appreciated.

PS: I checked other annotation examples, there they dont have such issue.

BlindMonk wrote at 2013-07-30 16:00:

Is it a possible bug??

If I set both width and height of imageannotation, the image is not rendered.

yetangye wrote at 2013-08-27 17:33:

I also encountered the same problem.
Is there any method can avoid this problem?
Thanks.

BlindMonk wrote at 2013-08-27 17:42:

yes. It is a bug. I posted a solution. you have to recompile after fixing here.

objo wrote at 2013-08-28 00:00:

Thank you! I have submitted the bug-fix. I also added some examples using reverse axes.

yetangye wrote at 2013-08-28 05:48:

BlindMonk wrote:
yes. It is a bug. I posted a solution. you have to recompile after fixing here.
Thank you very much!
I have built and tested it, it works. Your solution saved my life :)