简体   繁体   English

是否有任何默认策略来准备应用程序以进行解决方案更改?

[英]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? 如何准备Silverlight或WPF应用程序从大分辨率更改为小分辨率?

I guess using dockpanel strategy only works for changing from a small to a big resolution. 我想使用dockpanel策略只适用于从小分辨率变为大分辨率。

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. 问题:我有一个按钮,像素1024,768的末端。我将分辨率更改为800x600。

Some time ago I had a similar issue. 前段时间我有类似的问题。 As a workaround I surrounded the window content in a Viewbox . 作为一种解决方法,我在Viewbox中包含了窗口内容。

Users that used 1024x768 instead of 1280x1024 see the application content smaller, but they preferred this than scrolling all the time. 使用1024x768而不是1280x1024的用户会看到应用程序内容较小,但他们更喜欢这一点,而不是一直滚动。 (WPF) (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. 那么,您可以将您的布局设计为Stretch并考虑800x600进行设计,因此每当布局大于800x600时,它都适合。 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). 如果你真的想要一些花哨的东西,检测窗口大小/ ActualHeight和ActualWidth(使用SizeChanged)的变化,然后通过代码(使用动态变换)根据大小缩放应用程序。

For example, in the "LayoutRoot" in your main view: 例如,在主视图中的“LayoutRoot”中:

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. 希望这可以帮助。

I think doing this way is better: 我认为这样做更好:


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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有什么方法可以以比Jpeg低的分辨率保存位图? 要更改分辨率手册? - Is there any way to save a bitmap in a lower resolution then Jpeg ? To change the resolution manual? 应用程序启动时如何更改屏幕分辨率? - how to change screen resolution when application launches? 使用WPF准备多语言WPF应用程序时应该更改什么 - What should I change to prepare multilingual wpf application with wpf 如何在Windows Phone 8,8.1中更改默认视频捕获分辨率 - how to change the default video capture resolution in windows phone 8,8.1 通过WPF客户端应用程序更改系统时间的策略 - Strategy to change system time via WPF client application c#中开发winform应用有什么标准的屏幕分辨率吗 - Is there is any standard screen resolution to develop winform application in c# WPF应用程序无法处理远程桌面分辨率更改 - WPF application unable to handle remote desktop resolution change 默认策略。 策略模式C# - Default Strategy. Strategy Pattern C# 基类/后代类解析的策略和工厂模式 - Strategy & factory pattern for base/descendant class resolution 跟踪Windows窗体应用程序中的屏幕更改和屏幕分辨率更改以更改表单大小 - Keep track of screen change and screen resolution change in Windows Form Application to change form size
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM