-2
我在XAML中繪製了一些路徑,但我想在每個房間中放置標籤。所以:在每個路徑中放置標籤
我想寫例如:走廊在一個特定的座標。
XAML代碼: - 這不是這家工廠的實際代碼,但我的是使用相同的MINICode - 中號&ž
<StackPanel>
<Viewbox Stretch="Fill" HorizontalAlignment="Left" Height="600" VerticalAlignment="Top" Width="600">
<Grid>
<Path Fill="#ff221e1f" Data="F1 M 65.778,45.310 L 85.092,45.310 L 85.092,47.630 L 68.504,47.630 L 68.504,63.174 L 83.700,63.174 L 83.700,65.494 L 68.504,65.494 L 68.504,84.402 L 65.778,84.402 L 65.778,45.310 Z"/>
<Path Fill="#ff221e1f" Data="F1 M 95.300,64.218 L 101.505,64.218 C 107.538,64.218 111.482,60.854 111.482,55.692 C 111.482,49.718 107.074,47.282 100.926,47.282 C 98.257,47.282 96.286,47.572 95.300,47.804 L 95.300,64.218 Z M 92.574,45.832 C 94.952,45.310 98.316,45.020 100.984,45.020 C 106.087,45.020 109.278,46.122 111.540,48.268 C 113.222,49.892 114.266,52.502 114.266,55.228 C 114.266,60.506 111.133,63.870 106.610,65.436 L 106.610,65.552 C 109.742,66.538 111.713,69.496 112.642,73.846 C 113.976,79.936 114.730,82.836 115.542,84.402 L 112.642,84.402 C 112.062,83.242 111.192,79.820 110.148,74.890 C 108.988,69.264 106.551,66.712 101.390,66.480 L 95.300,66.480 L 95.300,84.402 L 92.574,84.402 L 92.574,45.832 Z"/>
<Path StrokeThickness="3.0" Stroke="#ff221e1f" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Data="F1 M 179.125,90.312 C 179.125,139.362 139.362,179.125 90.312,179.125 C 41.263,179.125 1.500,139.362 1.500,90.312 C 1.500,41.263 41.263,1.500 90.312,1.500 C 139.362,1.500 179.125,41.263 179.125,90.312 Z"/>
<Path StrokeThickness="3.0" Stroke="#ff221e1f" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" Data="F1 M 75.533,117.798 L 103.986,117.798"/>
</Grid>
</Viewbox>
</StackPanel>
我怎麼可以把我想要的座標標籤?
此致
Hi @ H.B。謝謝你的回答,但我想寫在房間中間。就像A廳B廳一號廳2號廳一樣。你知道另一種方式嗎?我需要定義正確的位置。 – Antoine
好吧,有找到某種多邊形的中心的算法,那麼你只需要把你的標籤放在那裏,並在兩個方向上將它移回50%(例如使用'TranslateTransform') –
就XAML而言標籤?僅僅將正確?我必須定位,但我不知道如何去做。我發現了其中一種算法,並且我找到了路徑中所有圖形的所有中心,但我必須將它們與文本一起傳遞到XAML中的某處。你能幫我實現嗎? – Antoine