DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 1 of 1

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    1

    Smile Resize of Big images within a viewbox

    Hi, Experts.

    I am dealing with 5 big images. (The resolution is about 5000 * 3000).
    After loading the images and displaying them on the same canvas, I zoom-in and zoom-out the images at the same time by moving a slider.
    But during this zoom-in/out actions, my program (actually my computer) is frozen.
    When I used 10 small images (about 800 * 600), there was no problem.

    The following code is called when I change the image size (by zoom-in/out).

    Code:
    private static void OnImageZoomChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) 
    { 
        ImageScrollControl control = obj as ImageScrollControl; 
        double zoom = (double)args.NewValue; 
     
        if (control == null || zoom < 0.1 || zoom > 21) return; 
     
        else 
        { 
            // double scale = (zoom <= 20) ? (zoom / 20) : (zoom - 19); 
            control.ImageViewBox.Height = control._pixelHeight * zoom; 
            control.ImageViewBox.Width = control._pixelWidth * zoom; 
                             
            control.ImageScrollViewer.UpdateLayout(); 
        } 
    }

    If I comment out the following two lines, then works fine.
    // control.ImageViewBox.Height = control._pixelHeight * zoom;
    // control.ImageViewBox.Width = control._pixelWidth * zoom;
    But the size of the image in the viewbox doesn't change at all.

    The following is the XAML code.

    Code:
    <TabControl Height="Auto" 
                Width="Auto" 
                x:Name="LogTabControl"> 
        <TabItem Header="Image"> 
            <RegistrationFront_UI_Custom:ZoomNMoveScrollControl  
                          x:Name="ImageScrollViewer" 
                          Width="Auto" 
                          Height="Auto" 
                          HorizontalContentAlignment="Center" 
                          VerticalContentAlignment="Center" 
                          HorizontalScrollBarVisibility="Auto" 
                          VerticalScrollBarVisibility="Auto" 
                          PreviewMouseWheel="ImageScrollViewer_PreviewMouseWheel"> 
                <Viewbox x:Name="ImageViewBox" 
                         OpacityMask="{x:Null}" 
                         ScrollViewer.HorizontalScrollBarVisibility="Disabled"> 
                    <Canvas x:Name="ImageCanvas" 
                            HorizontalAlignment="Center" 
                            VerticalAlignment="Center">                  
                         
                    </Canvas> 
                </Viewbox> 
            </RegistrationFront_UI_Custom:ZoomNMoveScrollControl> 
        </TabItem> 
        <TabItem  
                 x:Name="LogTab" 
                 Header="Logs" 
                 Width="Auto" 
                 Height="Auto"> 
            <RegistrationFront_UI_Custom:LogBrowser 
              x:Name="LogBrowserTab" 
              CurrentProject="{Binding Path=CurrentProject, ElementName=UserControl, Mode=Default}" /> 
        </TabItem> 
    </TabControl>

    Do you have any idea about this problem?
    Any comment will be really appreciated.

    Thank you.

    Kim.
    Last edited by sehnkim; 01-28-2009 at 06:57 PM. Reason: add code

Similar Threads

  1. Replies: 1
    Last Post: 01-29-2008, 06:53 AM
  2. Replies: 0
    Last Post: 10-29-2001, 01:55 PM
  3. loading images dynamically is slow
    By Michael Shutt in forum Web
    Replies: 0
    Last Post: 06-26-2001, 02:25 PM
  4. Re: We don't get round trips...
    By Avron Polakow in forum Web
    Replies: 1
    Last Post: 11-06-2000, 02:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links