我尝试在WPF中创建一个动画复选框,类似于this one。
此问题与this one不重复,因为动画的帧速率没有问题。
动画和故事板已经到位,并且工作正常,但是对于某些rason来说,当动画正在播放时,看起来整个事情正在发生震动,如here所示。效果最好在盒子的右边缘看到。
以下是自定义复选框的XAML源代码。我不认为有必要发布代码,因为除了RoutedEvent定义(Timeline.DesiredFrameRate
和SnapsToDevicePixels
)之外,它不包含任何其他内容。
true
我已经尝试通过将 <!-- https://mvnrepository.com/artifact/com.databricks/spark-xml -->
<dependency>
<groupId>com.databricks</groupId>
<artifactId>spark-xml_2.11</artifactId>
<version>0.4.1</version>
</dependency>
设置为60来增加故事板帧率,正如您在代码中看到的那样,但它对动画的不稳定性没有影响。
我还尝试将 <!-- Create Form -->
<!-- Send data with the 'post' method to the file called 'retrieve.php' -->
<form action="retrieve.php" method="post">
<!-- Choose source language -->
<!-- Flex Container, 1st div -->
<div class="flex-container">
<!-- Flex Container, 1st div -->
<div>
<p class="instruction-frame" id="srclanguage">Source Language<br />
<!-- Indication for single selection -->
<span class="smallfont">Select a single language</span></p>
<!-- Adjust the width of the select list-->
<select class="my_dropdown" name="source" size="5">
<option cvalue="">-- Select --</option>
<option value="Terms_de">German</option>
<option value="Terms_us">English - US</option>
<option value="Terms_uk">English - UK</option>
<option value="Terms_fr">French</option>
<option value="Terms_ardz">Arabic - Algeria</option>
<option value="Terms_arbh">Arabic - Bahrain</option>
<option value="Terms_artd">Arabic - Chad</option>
<option value="Terms_arkm">Arabic - Comoros</option>
<option value="Terms_ardj">Arabic - Djibouti</option>
<option value="Terms_areg">Arabic - Egypt</option>
<option value="Terms_arer">Arabic - Eritrea</option>
<option value="Terms_ariq">Arabic - Iraq</option>
<option value="Terms_aril">Arabic - Israel</option>
<option value="Terms_arjo">Arabic - Jordan</option>
<option value="Terms_arkw">Arabic - Kuwait</option>
<option value="Terms_arlb">Arabic - Lebanon</option>
<option value="Terms_arly">Arabic - Libya</option>
<option value="Terms_armt">Arabic - Malta</option>
<option value="Terms_armr">Arabic - Mauritania</option>
<option value="Terms_arma">Arabic - Morocco</option>
<option value="Terms_arom">Arabic - Oman</option>
<option value="Terms_arps">Arabic - Palestine</option>
<option value="Terms_arqa">Arabic - Qatar</option>
<option value="Terms_arsa">Arabic - Saudi Arabia</option>
<option value="Terms_arso">Arabic - Somalia</option>
<option value="Terms_arsd">Arabic - Sudan</option>
<option value="Terms_arsy">Arabic - Syria</option>
<option value="Terms_artz">Arabic - Tanzania</option>
<option value="Terms_artn">Arabic - Tunisia</option>
<option value="Terms_arae">Arabic - UAE</option>
<option value="Terms_arye">Arabic - Yemen</option>
</select>
</div>
<!-- Flex Container, 2nd div -->
<div>
<p class="instruction-frame" id="trgtlanguage">Target Languages<br />
<!-- Indication for multiple selection -->
<span class="smallfont">Hold Ctrl for multiple selection</span></p>
<!-- Allowing multiple selection -->
<select class="my_dropdown" name="target" size="5" multiple="multiple">
<option value="">-- Select --</option>
<option value="Terms_de">German</option>
<option value="Terms_us">English - US</option>
<option value="Terms_uk">English - UK</option>
<option value="Terms_fr">French</option>
<option value="Terms_ardz">Arabic - Algeria</option>
<option value="Terms_arbh">Arabic - Bahrain</option>
<option value="Terms_artd">Arabic - Chad</option>
<option value="Terms_arkm">Arabic - Comoros</option>
<option value="Terms_ardj">Arabic - Djibouti</option>
<option value="Terms_areg">Arabic - Egypt</option>
<option value="Terms_arer">Arabic - Eritrea</option>
<option value="Terms_ariq">Arabic - Iraq</option>
<option value="Terms_aril">Arabic - Israel</option>
<option value="Terms_arjo">Arabic - Jordan</option>
<option value="Terms_arkw">Arabic - Kuwait</option>
<option value="Terms_arlb">Arabic - Lebanon</option>
<option value="Terms_arly">Arabic - Libya</option>
<option value="Terms_armt">Arabic - Malta</option>
<option value="Terms_armr">Arabic - Mauritania</option>
<option value="Terms_arma">Arabic - Morocco</option>
<option value="Terms_arom">Arabic - Oman</option>
<option value="Terms_arps">Arabic - Palestine</option>
<option value="Terms_arqa">Arabic - Qatar</option>
<option value="Terms_arsa">Arabic - Saudi Arabia</option>
<option value="Terms_arso">Arabic - Somalia</option>
<option value="Terms_arsd">Arabic - Sudan</option>
<option value="Terms_arsy">Arabic - Syria</option>
<option value="Terms_artz">Arabic - Tanzania</option>
<option value="Terms_artn">Arabic - Tunisia</option>
<option value="Terms_arae">Arabic - UAE</option>
<option value="Terms_arye">Arabic - Yemen</option>
</select>
</div>
<!-- Position the submit button at the bottom -->
<div class="button">
<div class="row" id="button">
<div class="col-lg-12">
<div class="input-group">
<input type="text" class="form-control" name="search" placeholder="Enter your term..." aria-label="Enter your term here">
<span class="input-group-btn">
<!-- Choose different color for the button through 'btn-primary' -->
<!-- type 'submit' to call the file 'retrieve.php' once the user clicks the button -->
<button class="btn btn-primary" type="submit">Search</button>
</span>
</div>
</div>
</div>
</div>
</div>
属性设置为<?php
//Connect to the MySQL server with mysqli
require_once 'login.php';
$conn = new mysqli($hostname, $username, $password, $database);
if ($conn->connect_error)
{
echo "Connection to database failed. Please retry later.";
exit;
}
//Reduce length of variable names
//Check if mandatory fields have been filled in
if (isset($_POST['source'])) {
$source=$_POST['source'];
}
else {
echo"<p class=\"warning\">"."A mandatory field is still empty. Please retry again."."<br />"."<br />"."<a href=\"query.php\">"."<img src=\"stock-home.png\" alt=\"Home\" />"."</a>"."</p>";
exit;
}
if (isset($_POST['target'])) {
$target=$_POST['target'];
}
else {
echo"<p class=\"warning\">"."A mandatory field is still empty. Please retry again."."<br />"."<br />"."<a href=\"query.php\">"."<img src=\"stock-home.png\" alt=\"Home\" />"."</a>"."</p>";
exit;
}
if (isset($_POST['search'])) {
$search=$_POST['search'];
}
else {
echo"<p class=\"warning\">"."A mandatory field is still empty. Please retry again."."<br />"."<br />"."<a href=\"query.php\">"."<img src=\"stock-home.png\" alt=\"Home\" />"."</a>"."</p>";
exit;
}
if (!$search || !$source || !$target)
{
echo"<p class=\"warning\">"."A mandatory field is still empty. Please retry again."."<br />"."<br />"."<a href=\"query.php\">"."<img src=\"stock-home.png\" alt=\"Home\" />"."</a>"."</p>";
exit;
}
//Remove whitespace from beginning and end of the string
$search=trim($search);
//Escaping control characters
if (!get_magic_quotes_gpc())
{
$source = addslashes($source);
$target = addslashes($target);
$search = addslashes($search);
}
//Test
$query = "SELECT * FROM legal_glossary.determs WHERE ".$source." LIKE '%".$search."%'";
$result = $conn->query($query);
$num_results = $result->num_rows;
echo '<p>Number of entries found: '.$num_results.'</p>';
?>
,希望它能改善动画效果。
这种震动效果的原因可能是什么,我该如何消除它?