Search code examples
c#monofixedgtk#

C# Invert Hscale


I have a Hscale for determining the vertical position of an image. The image is placed inside a eventbox within a fixed widget. I move the image on the fixed widget by using the following code:

fixed1.Move(eventbox_photo, Convert.ToInt16 (hscale_PhotoApH.Value*0.3),
            Convert.ToInt16(hscale_PhotoApV.Value*0.3));

This image is then printed to a PDF document (using Itextsharp with WriteSelectedRows) and located at the same position as the fixed widget. However, the problem is that a value of 842 on the Hscale is Equal to Top-Most on in the PDF document but equal to Bottom-Most on the Fixed widget. Thus, at a hscale value of 842, the image is at the top of the PDF-page but at the bottom on the fixed widget.

How can I make the fixed widget to 'see' 842 as 0 ?? Or does anyone have any other sollution?


Solution

  • I figured this out. Just minus the MAX value of Hscale.value with the value of Hscale.value, like this:

     fixed1.Move(eventbox_photo, Convert.ToInt16 (hscale_PhotoApH.Value*0.3), Convert.ToInt16((842*0.3)-(hscale_PhotoApV.Value*0.3)));