答案 0 :(得分:0)
您可以使用CSS,如下所示
void Composite_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
// scale the image
FrameworkElement Elem = sender as FrameworkElement;
CompositeTransform CT = Elem.RenderTransform as CompositeTransform;
if (CT != null)
{
CT.ScaleX *= e.Delta.Scale;
CT.ScaleY *= e.Delta.Scale;
CT.CenterX = Elem.ActualWidth / 2;
CT.CenterY = Elem.ActualHeight / 2;
//if (CT.ScaleX < 0.25) CT.ScaleX = 0.25;
//if (CT.ScaleY < 0.25) CT.ScaleY = 0.25;
//if (CT.ScaleX > 1.15) CT.ScaleX = 1.15;
//if (CT.ScaleY > 1.15) CT.ScaleY = 1.15;
}
double Left = Canvas.GetLeft(Elem);
double Top = Canvas.GetTop(Elem);
//output.Text = "Left:=" + Left + " Top:=" + Top+"\nActualWidth:="+Elem.Width+" ActualHeight"+Elem.Height;
Left += e.Delta.Translation.X;//Get x cordinate
Top += e.Delta.Translation.Y;//Get y cordinate
//check for bounds
double xOffset = Elem.ActualWidth * (CT.ScaleX-1) / 2;
double yOffset = Elem.ActualHeight * (CT.ScaleY-1) / 2;
if (Left-xOffset < 0)
{
Left = xOffset;
}
else if (Left > (my_canvas.ActualWidth - Elem.ActualWidth-xOffset))
{
Left = my_canvas.ActualWidth - Elem.ActualWidth-xOffset;
}
if (Top -yOffset<0 )
{
Top = yOffset;
}
else if (Top > (my_canvas.ActualHeight - Elem.ActualHeight-yOffset))
{
Top = my_canvas.ActualHeight - Elem.ActualHeight-yOffset;
}
Canvas.SetLeft(Elem, Left);
Canvas.SetTop(Elem, Top);
}
答案 1 :(得分:0)
有一些方法可以获得这种格式。
.find
和position:absolute;
,top
值left
类和透视container
值col
margin:0 auto;
导航菜单答案 2 :(得分:0)
您可以使用col-sm-offset-#,其中#是您希望它偏移的程度。请注意,这不会自动将所有内容集中在内容中,但会放置
<div class="col-sm-8 col-sm-offset-2">
位于页面中央。至于“Hello world”,你需要单独的css t0中心。在这个例子中,bootstrap中的列系统基于12列,如果你的主div是8列宽,偏移量是2列,那么它将使div居中。
<div class="col-sm-8 col-sm-offset-2">
<div class="jumbotron">
<h1> Hello World </h1>
</div>
</div>