1

我实现了一个用户控件,但是我在重新缩放窗口时遇到了问题。我知道当我缩小窗口时,一切都会缩放,每个文本框和标签也会变小。但这不是我想要的,我只是希望当我缩小屏幕时,一切都保持相同的大小,并且出现滚动条(垂直和水平)。我怎么做?

谢谢

4

1 回答 1

1

Assumption
The behaviour you describe, is not mandatory the default layout-behaviour of WPF. It depends on the layout-controls you use. I assume, you're using a Grid with setting it's columns and rows to the Start (*)-GridLengths. This would have more or less such an effect as you describe (without scaling). Or maybe you are using a ViewBox, this control scales the whole content based on the available layout size.
Solution
I guess that wrapping your whole content into a ScrollViewer will probably do what you desire. If not, I suggest that you post some XAML-code to show us how you have built your content.

<ScrollViewer>
    <YourContent>

    </YourContent>
</ScrollViewer>

Update
If you really scale your window (applying a ScaleTransformation) and you want your UserControl to be the only control within that does not scale, you have to scale your UserControl in the opposite direction as you have done it with your window. Apply a ScaleTransformation and set the scale values to 1/scale. Or try to use the ViewBox to blow up the content of your UserControl, but this will not be very exact.

于 2011-05-06T06:58:50.280 回答