需要帮助解决这个问题。
我在 MainPage.xaml 中初始化一个文本框
<TextBox
x:Name="box"
HorizontalAlignment="Left"
TextWrapping="NoWrap"
Text="TextBox"
VerticalAlignment="Center"
RenderTransformOrigin="1.332,-26.438"
Height="23" Width="1366"
HorizontalContentAlignment="Left">
</TextBox>
然后我尝试更改 MainPage.xaml.cs 中的边距:
box.Margin = new Thickness(0,grid.Height - 23,0,0);
这是运行时错误
An exception of type 'System.Runtime.InteropServices.COMException'
occurred in Console.exe but was not handled in user code
Additional information: Error HRESULT E_FAIL has been returned from
a call to a COM component.
这是显示边距更改代码和错误的图像: http: //screencast.com/t/U7pzizHzb