viewbox

Setting the same font size across multiple viewboxes

自作多情 提交于 2019-12-14 02:43:48
问题 Let's say I have two viewboxes with two textblocks inside them. They both have the same Width and Height, but the text won't be the same length. How could I make them have the same font size, regardless of the number of characters? Code example: <Viewbox x:Name="vb1"> <TextBlock Text="Some text" /> </Viewbox> <Viewbox x:Name="vb2"> <TextBlock Text="Some bigger text" /> </Viewbox> Here's what I would like: 回答1: Place both TextBlock controls in the same ViewBox : <Viewbox> <Grid> <TextBlock

Why does UseLayoutRounding not seem to work with Viewbox?

人走茶凉 提交于 2019-12-12 04:39:10
问题 I'm trying to write a tile-based game in WPF 4. I want the game board to scale to fit the window, so I'm using a Viewbox; but I want each tile to be on a nice, crisp pixel boundary. I might be wrong, but my understanding is that this is what the new UseLayoutRounding property is supposed to be for -- but it isn't working the way I expect. Here's a window that demonstrates the issue: <Window x:Class="Tyler.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http

How do I make the path scale to the container in Flex (View Box)?

老子叫甜甜 提交于 2019-12-12 01:55:25
问题 I have the following markup: <s:Group width="100%" height="100%"> <s:BorderContainer borderWeight="3" borderColor="black" cornerRadius="5" width="100%" height="100%"> <s:Path> <s:stroke> <s:SolidColorStroke color="black" /> </s:stroke> <s:data>M 14.153 14.788 C 13.856 15.25 13.161 15.628 12.612 15.628 L 0.766 15.628 C 0.216 15.628 -0.028 15.228 0.225 14.739 L 3.307 8.765 C 3.56 8.276 3.56 7.477 3.307 6.988 L 0.225 1.014 C -0.028 0.525 0.216 0.125 0.766 0.125 L 12.612 0.125 C 13.161 0.125 13

How to keep viewBox centered when “zooming” in SVGs?

非 Y 不嫁゛ 提交于 2019-12-11 15:21:34
问题 Often I use the viewBox attribute to "zoom" a SVG element. Zoom is accomplished of course by using lower width and height values for the viewBox attribute - but the x and y values are tricky to figure out for keeping the scene centered. Below is a snippet where viewBox="0 0 100 100" . ( x y width height ) This is my starting point. The scene is to scale and starts at the top left corner. <head> <link rel="stylesheet" href="https://codepen.io/basement/pen/oepKxY.css"> </head> <body> <iframe

WPF ViewBox blocks VisualTreeHelper search

混江龙づ霸主 提交于 2019-12-11 15:17:02
问题 I have tried this Navigation Service approach (View First) for MVVM-Light WPF https://stackoverflow.com/a/28968560/5272185 I realized that the VisualTreeHelper search for the Frame element does not find the Frame if the Frame is located inside a ViewBox. Is there a good explanation of such strange behaviour? Is it possible to work around it? 回答1: It turned out that the example code in the link was the problem. If you run into this type of problem I recommend to read the following from Josh

Putting Canvas Inside Viewbox in Silverlight With Image

独自空忆成欢 提交于 2019-12-11 11:03:29
问题 All, I'm trying to make the silverlight app I'm making resize in a reasonable manner. To do this, I thought I would use a dynamic grid. In the center of the grid I need to put an image inside of a canvas because I will dynamically be positioning objects on top of it. Ideally, as the user makes the browser window larger, the center column would be able to resize and grow larger, thereby growing the image. Here's what I've got: <Viewbox Grid.Row="0" Grid.Column="1"> <Canvas x:Name=

Checking and deleting attributes in SVG using Batik in Java

家住魔仙堡 提交于 2019-12-11 10:46:03
问题 The question basically says it all. How can I check if SVG has a viewBox attribute? I am using Batik lib. I need this because I need to (at least) notify the user that there is a viewBox attribute. Can I delete it? 回答1: Using org.w3c.dom classes you'd do something along these lines... String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); URL url = new URL(getCodeBase(), "fileName.svg"); Document doc = f.createDocument(url

Viewbox makes WindowsFormsHost disappear in WPF

久未见 提交于 2019-12-10 21:44:52
问题 I have a WPF project where I maintain video ratio, by placing video control inside a ViewBox. The video control is a WinForms object wrapped inside a WindowsFormsHost. I also added a gridSplitter to resize the ViewBox. It all worked great, until I noticed a strange bug. When I would use the gridSplitter control to minimize the ViewBox close to zero, the video ratio would get screwed up after expanding it again. And when I used gridSplitter to contract the ViewBox all the way down to 0, the

SVG viewBox Coordinates

北慕城南 提交于 2019-12-10 11:41:23
问题 I'm just learning details about the SVG viewport and viewBox. What I find confusing is, that it seem counter-intuitively, despite all positive x and y coordinates going left to right and top to bottom respectively in web design, the viewBox coordinate system seems to go right to left, and bottom to top respectively? Am I understanding this correctly, and does anybody know why this is the case. Thanks 回答1: This is not correct. viewBox declaration is x, y, width, height. And the origin 0,0 is

WPF. How to show only part of big canvas?

拜拜、爱过 提交于 2019-12-10 04:03:19
问题 Lets say I have a canvas defined to be 1000x1000 big. Is it possible to only show a 100x100 part of it in a Viewbox(or a rectangel)? Any help is apreciated..... 回答1: If you work with Brushes, you might want to take a look at Viewbox and Viewport in WPF Edit: I just realised that Viewbox and Viewport are used for Brushes This is not really appropiate in your situation. I looked it up, and I think you will like the Clip property on UIElement. Since Canvas is also a UIElement, you can use the