Is there any default strategy to prepare application for a resolution change?

How to prepare a Silverlight or WPF application to change from a big resolution to a small resolution?

I guess using dockpanel strategy only works for changing from a small to a big resolution.

So, is there any default strategy? Thanks.

Problem: I have a button the ends in the pixel 1024, 768. And I change the resolution to 800x600.


Some time ago I had a similar issue. As a workaround I surrounded the window content in a Viewbox .

Users that used 1024x768 instead of 1280x1024 see the application content smaller, but they preferred this than scrolling all the time. (WPF)

I'll have to work on this for our next project, let's hope somebody has better ideas!


Well, you could design your layout to Stretch and designing it with 800x600 in mind, so whenever the layout becomes larger than 800x600 it will fit. But...

if you really want something fancy, detect the change in the window size/ActualHeight and ActualWidth (using SizeChanged) then scale the the application according to size via code (using dynamic transforms).

For example, in the "LayoutRoot" in your main view:

var x = new ScaleTransform();
            x.ScaleX = .5; // Do fancy computation here
            x.ScaleY = .5; // Do fancy computation here
            this.LayoutRoot.RenderTransform = x;

Just an idea, i mean if the screen is bigger than your design you enlarge and vice versa.

Hope this helps.


我认为这样做更好:


ScrollViewer Background="GreenYellow" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Name="layoutRoot">
        Canvas Width="1024" Height="768">
            dataInput:Label Height="50" Name="label1" Width="100" Canvas.Left="540" Canvas.Top="131" Content="aeeeeeeee" />
            Button Canvas.Left="12" Canvas.Top="131" Content="Button" Height="23" Name="button1" Width="75" />
            Button Canvas.Left="937" Canvas.Top="147" Content="Button" Height="23" Name="button2" Width="75" />
            Button Canvas.Left="510" Canvas.Top="21" Content="Button" Height="23" Name="button3" Width="75" />
            Button Canvas.Left="482" Canvas.Top="550" Content="Button" Height="23" Name="button4" Width="75" />
        /Canvas>
    /ScrollViewer>

链接地址: http://www.djcxy.com/p/6274.html

上一篇: 如何在Java中的多个Web应用程序中保持相同的会话ID

下一篇: 是否有任何默认策略来准备申请更改决议?