在 WPF 中,当用户在 中获得焦点时TextBox,我想要一些动画,该动画可以使TextBox变成多行并使其Width变大(当他打字时),并且当焦点丢失时,它TextBox会恢复到其原始大小。
大小未知。
此外,最终,这TextBox需要在 WPF 中DataGrid。
我以前从未做过动画,希望能帮助我入门。谢谢。
编辑:我已经成功地制作了动画,同时具有一些固定的宽度值(使其多行不起作用,但这并不重要)。所以我现在的问题是,如果这是未知的,我怎样才能回到原来的尺寸。我可以在Width房产上使用乘数吗?
到目前为止,这是我的代码:
<Window.Resources>
<Storyboard x:Key="GrowStoryboard">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBox" Storyboard.TargetProperty="(FrameworkElement.Width)">
<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="400" KeySpline="0.54,0.27,0.38,0.69"/>
</DoubleAnimationUsingKeyFrames>
<Int32Animation Duration="0:0:0.4" From="1" To="3" Storyboard.TargetName="textBox" Storyboard.TargetProperty="(TextBox.MinLines)">
</Int32Animation>
</Storyboard>
<Storyboard x:Key="ShrinkStoryboard">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBox" Storyboard.TargetProperty="(FrameworkElement.Width)">
<SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="200" KeySpline="0.54,0.27,0.38,0.69"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FocusManager.GotFocus" SourceName="textBox">
<BeginStoryboard x:Name="GrowStoryboard_BeginStoryboard" Storyboard="{StaticResource GrowStoryboard}"/>
</EventTrigger>
<EventTrigger RoutedEvent="FocusManager.LostFocus" SourceName="textBox">
<BeginStoryboard x:Name="ShrinkStoryboard_BeginStoryboard" Storyboard="{StaticResource ShrinkStoryboard}"/>
</EventTrigger>
</Window.Triggers>
<StackPanel>
<TextBox x:Name="textBox" …Run Code Online (Sandbox Code Playgroud) 我没有清楚getPreferredWidth()和getPreferredHeight()方法的概念.它们返回什么意味着返回值的基础.
getWidth()和getPreferredWidth()有什么区别???
谢谢..
我是新手Android和我面临一些问题...
我使用SurfaceView来扩展我的课程.在我的课堂上,我无法获得SurfaceView的宽度和高度.它始终为0.我试图在整个屏幕上轻弹图像(surfaceView),但我无法获得它的宽度和高度.
有什么建议?
以下是main.xml中SurfaceView的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<test.MyClass android:id="@+id/SurfaceView01"
android:layout_width="fill_parent" android:layout_height="fill_parent">
</test.MyClass>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 当我点击它时,我正试图获得目标的宽度和高度.event.currentTarget.width或event.currentTarget.width()(高度相同)不起作用.关于如何获得当前目标宽度和高度的任何想法?
我的iframe是一种风格style="width:100%",它几乎覆盖了页面宽度.但它在左侧和右侧留下了一小部分.所以我添加body { margin:0px; }了删除空间.
它有效,但问题是删除边距<body>会影响其他内容,例如<p>内部的段落<body>.
有没有办法消除保证金只为<iframe>?
码:
<!DOCTYPE html>
<html>
<body>
<p> hello </p>
<iframe src="http://www.weather.com" style="width:100%; height:95%; margin:0px"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我运行一个生成HTML页面的脚本,但是我无法正确格式化生成的表格.需要制作一个尽可能宽的桌子.目前,我必须指定一个特定的宽度(1500px),以便每个单元格的内容不会换行到下一行.这是一个例子:
With width set to 1500px:
+-----------------------------+------------------------------+
|Contents of my cell | Contents of other cell |
+-----------------------------+------------------------------+
With width set to 100%:
+-------------------+--------------------+
|Contents of my |Contents of other |
|cell |cell |
+-------------------+--------------------+
Run Code Online (Sandbox Code Playgroud)
理想情况下,我的文本不会换行(例如,当宽度设置为1500px时),但不必设置静态表格宽度.有时,表格可能需要比1500更宽(或更小),所以我希望宽度尽可能地动态.
这是我目前正在使用的CSS:
<style type="text/css">
h1 {
text-shadow: rgba(255, 255, 255, 0.796875) 0px 1px 0px;
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
font-weight: normal;
padding: 7px 7px 8px;
text-align: left;
line-height: 1.3em;
font-size: 24px;
}
table {
border: 1px solid #DFDFDF;
background-color: #F9F9F9;-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px; …Run Code Online (Sandbox Code Playgroud) 请看这个小提琴http://jsfiddle.net/MKwwH/
我希望链接images-link从右向左滑动切换?
$(document).ready(function() {
$('.hidden').hide()
});
$('.soundDiv-link').click(function() {
$('#soundDiv').slideToggle("slow")
});
$('.videoDiv-link').click(function() {
$('#videoDiv').next().animate({width: 'toggle'}, "slow")
});
$('.imagesDiv-link').click(function() {
$('#imagesDiv').animate({width: 'toggle'}, "slow")
});
Run Code Online (Sandbox Code Playgroud) 大家好我一直试图找出如何从SPS nal单位计算宽度.我有H264视频,它有这些参数
h264 (High), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], 20 fps, 20 tbr, 1200k tbn, 40 tbc
Run Code Online (Sandbox Code Playgroud)
我一直在寻找一个可以计算宽度(1280)和高度(720)的公式但是没有找到任何可以帮助我的公式.现在我正在使用这个公式,它适用于大多数H264流,但在这种情况下,高度和宽度是80x48
if(frame_cropping_flag) {
width = ((pic_width_in_mbs_minus1 +1)*16) - frame_crop_left_offset*2 - frame_crop_right_offset*2;
height= ((2 - frame_mbs_only_flag)* (pic_height_in_map_units_minus1 +1) * 16) - (frame_crop_top_offset * 2) - (frame_crop_bottom_offset * 2);
}
else {
width = ((pic_width_in_mbs_minus1 +1)*16);
height= ((2 - frame_mbs_only_flag)* (pic_height_in_map_units_minus1 +1) * 16);
}
Run Code Online (Sandbox Code Playgroud)
这里是SPS as base64
Z2QAKa2EBUViuKxUdCAqKxXFYqOhAVFYrisVHQgKisVxWKjoQFRWK4rFR0ICorFcVio6ECSFITk8nyfk/k/J8nm5s00IEkKQnJ5Pk/J/J+T5PNzZprQCgC3YCqQAAAMB4AAASwGBAAH0AAADAjKAve+F4RCNQA==
Run Code Online (Sandbox Code Playgroud)
这是我解析过的SPS:
======= SPS =======
profile_idc : 100
constraint_set0_flag : 0
constraint_set1_flag : 0 …Run Code Online (Sandbox Code Playgroud) 我试图让多个div占用父div的整个宽度.为了做到这一点,我使用display:table和display:table-cell.这种方法的问题是我不能为子div添加边距以便在它们之间留出一些空间.现在他们都堆叠在一起,看起来不太好.
有什么建议?
这是代码:
HTML
.parent {
text-align:center;
margin:0px;
width:500px;
padding:0px;
background:blue;
display:table;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
list-style-type:none;
}
.child{
padding:15px;
background:#f00;
display:table-cell;
list-style-type:none;
}
.child:nth-child(2n) {background:green;}Run Code Online (Sandbox Code Playgroud)
CSS
<div class="parent">
<div class="child">sometext</div>
<div class="child">somemoretext</div>
<div class="child">sometext</div>
<div class="child">sometext</div>
</div>Run Code Online (Sandbox Code Playgroud)
这是一个实时版本:http://codepen.io/mariomez/pen/MaXjqW
我正在尝试设置表的最大宽度,但它似乎不起作用.如果表格中的单词太长,它会自动扩展表格的宽度.我该如何阻止这种情况发生,而是说太长的话会转到下一行呢?
<style>
table {
max-width: 300px;
}
table,td {
border: 1px solid red;
}
div {
border: 1px solid blue;
word-wrap: break-word;
}
</style>Run Code Online (Sandbox Code Playgroud)
<table>
<tr>
<td>
<div> hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello </div>
</td>
</tr>
</table>Run Code Online (Sandbox Code Playgroud)
width ×10
css ×4
height ×4
html ×4
css-tables ×2
jquery ×2
android ×1
animation ×1
blackberry ×1
css3 ×1
events ×1
frame ×1
h.264 ×1
html-table ×1
iframe ×1
layout ×1
margin ×1
max ×1
resize ×1
resolution ×1
slidetoggle ×1
storyboard ×1
styles ×1
surfaceview ×1
textbox ×1
wpf ×1