Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Display error in scroll view when created from DIB?
Started by fyjin99 at 06-10-2008 23:42. Topic has 2 replies.

Print Search « Previous Thread Next Thread »
  06-10-2008, 23:42
fyjin99 is not online. Last active: 6/2/2008 2:44:21 AM fyjin99

Top 500 Posts
Joined on 06-02-2008
Posts 8
Display error in scroll view when created from DIB?
Reply Quote

I display the IRasterImage in scroll view. The OnPain() function as below:

    protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (image == null)
                return;
            Point pt = AutoScrollPosition;
            Graphics gfx = e.Graphics;
            int iDrawWidth;
            int iDrawHeight;
            iDrawWidth = ClientSize.Width - pt.X;
            iDrawHeight = ClientSize.Height - pt.Y;
            if (iDrawWidth >= image.Width)
                iDrawWidth = image.Width;
            if (iDrawHeight >= image.Height)
                iDrawHeight = image.Height;
            iDrawWidth += pt.X;
            iDrawHeight += pt.Y;
            Rectangle dstRect = new Rectangle(0, 0, iDrawWidth, iDrawHeight);
            Rectangle srcRect = new Rectangle(-pt.X, -pt.Y, iDrawWidth, iDrawHeight);
            image.Paint(gfx, srcRect, dstRect,RasterPaintProperties.Default);
        }
When the image loaded originally it works well. When the Vertical Scroll Bar in the Top and the image will show it's Top and when the Vertical Scroll Bar in the Bottom and the image will show it's Bottom.
But when the image was created from a DIB, like this:
image = RasterImage.FromDib(image.ToDib(RasterConvertToDibType.BitmapInfoHeader));
It doesn't work. When the Vertical Scroll Bar in the Top and the image will show it's Bottom! When the Vertical Scroll Bar in the Bottom and the image will show it's Top! I wonder what's happened.

   Report 
  06-11-2008, 5:38
Yasir Alani is not online. Last active: 9/2/2008 12:40:05 PM Yasir Alani



Top 25 Posts
Joined on 02-05-2007
Posts 204
Re: Display error in scroll view when created from DIB?
Reply Quote

I think the problem is related to the image's view perspective (orientation). However, I'm not sure how this happens or the best way to solve it.

 

Could you put your code in a small test project (not your full application) that shows the problem? Pack the project in a ZIP or RAR file and post it here.

 

If you don't want to post your project here, please send it to support@leadtools.com and mention this forum post.


Yasir Alani
LEADTOOLS Technical Support
   Report 
  06-13-2008, 1:18
fyjin99 is not online. Last active: 6/2/2008 2:44:21 AM fyjin99

Top 500 Posts
Joined on 06-02-2008
Posts 8
Re: Display error in scroll view when created from DIB?
Reply Quote
Thanks! It's the image's view perspective problem. I've solve it.

   Report 
Post
LEAD Support Fo... » Developer » DotNet » Display error in scroll view when created from DIB?

Powered by Community Server, by Telligent Systems