我使用 ffmpeg 转换通过 ASPX 网页上传的视频文件。
ffmpeg转换效果很好。
我想为最终用户提供一个进度条。所以我在网页上放置了一个 updatePanel 并尝试读取文件大小......
执行此操作的正确/有效方法是什么?
我在 winform c# 应用程序中有一个进度条,我将其作为进度指示器。进度条可以有不同的最大尺寸,具体取决于用户输入的数量(可以超过 100),所以这就是我的设置方式:
this.pbLoadingWrite.Maximum = Input.Length;
this.pbLoadingWrite.Step = 1;
Run Code Online (Sandbox Code Playgroud)
然后只需更新进度条:
this.pbLoadingWrite.PerformStep();
Run Code Online (Sandbox Code Playgroud)
一切正常,但我想在进度栏顶部显示一个%数字以获得更好的可见性。
由于 Input.Length 可以 > 100,那么显示百分比的语法是什么?VS c# 中是否内置了任何辅助函数?
我有一个带有进度条的主窗体,我想从名为“Logic”的外部类更新进度条...但是,主窗体上已经引用了 Logic。如果我尝试引用逻辑中的主窗体来更新进度条,我只会遇到堆栈溢出。
在四处搜索时,我遇到了很多有关BackgroundWorker的主题......但这不是我想要使用的。我在 Logic 类中有一些特定的位置,我想通过使用 Progressbar.PerformStep() 来更新主窗体上的进度条。我尝试在主窗体上创建一个方法来更新进度栏并从 Logic 类中调用该方法,但它再次缺少引用......而且我不能只使用 MainForm frm1 = new MainForm() 而不导致其他地方都有错误。我在这里感到很困惑。
[编辑]
这是带有解决方案的代码(谢谢你们)----
主要形式:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Natural_Language_Processor
{
public partial class frm_Main : Form
{
Logic logic = new Logic();
public frm_Main()
{
InitializeComponent();
}
private void frm_Main_Load(object sender, EventArgs e)
{
Timer.Start();
}
private void btn_Enter_Click(object sender, EventArgs e)
{
logic.Progress += new Logic.ProgressDelegate(DisplayProgess);
logic.RaiseProgress(0);
logic.str_Input = txt_Input.Text; …Run Code Online (Sandbox Code Playgroud) 我必须在 Android 应用程序中等待几秒钟,并且想在此期间显示进度条,我该怎么做?
例如 :
@Override
protected void onCreate(Bundle savedInstanceState) {
timeForShow(5 //second);
}
.
.
.
private void timeForShow(long mytime){
myprogress.setVisibility(View.VISIBLE);
Waiting for mytime...
myprogress.setVisibility(View.GONE);
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码,但它不起作用:
Long timerforprogressbar ;
@Override
protected void onCreate(Bundle savedInstanceState) {
timerforprogressbar = (long) 5000 ;
new MyProgressBar().execute((Void)null);
}
.
.
.
class MyProgressBar extends AsyncTask<Void, Void, Void>{
@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
progressbar.setVisibility(View.VISIBLE);
try {
Thread.sleep(timerforprogressbar);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace(); …Run Code Online (Sandbox Code Playgroud) 我有一个带有图像的列表视图。用户可以单击缩略图,然后将下载更大的图像并将其显示在新活动内的 ImageView 中。
\n\nonclick 位于我的适配器中的 GetView 内:
\n\nholder.iconImage.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n\n try{\n\n //load the image\n String name = folderName.get(position).toString();\n Intent i = new Intent(context, ImageViewLarge.class);\n i.putExtra("link", link);\n i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n context.startActivity(i);\n\n\n }\n catch(Exception e){\n Toast.makeText(context, "errror: " + e.toString() , Toast.LENGTH_LONG).show();\n }\n }\n\n});\nRun Code Online (Sandbox Code Playgroud)\n\n显示图像可能需要几秒钟的时间,因此我希望在加载图像时在屏幕上显示一个对话框或一个圆形进度旋转圆圈。
\n\n如果我的 onclick 位于我的适配器内,我该如何执行此操作?
\n\n我在适配器内尝试了此操作,但收到错误:
\n\ndialog = ProgressDialog.show(context, "Opening Image","Please wait..");\n\n"Unable to add window \xe2\x80\x94 token null is not for an application\xe2\x80\x9d \nRun Code Online (Sandbox Code Playgroud)\n 我ProgressBar在我的应用程序中添加了一个,我希望它有一个透明的背景,所以我这样做了:
<ProgressBar IsIndeterminate="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<ProgressBar.Background>
<SolidColorBrush Color="Black" Opacity="0.5" />
</ProgressBar.Background>
</ProgressBar>
Run Code Online (Sandbox Code Playgroud)
在预览窗口中,一切看起来都很好,但是,当我运行我的应用程序时,它Background根本不存在。我找到的解决方案是将 放在ProgressBarGrid 中并Background在 中设置属性Grid,但由于预览显示它是正确的,并且属性在那里,它不应该工作吗?
更新:
根据@Chris W.的建议,我尝试覆盖ProgressBar元素的默认样式,如下所示:
<ProgressBar IsIndeterminate="True" Background="#FF000000" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="50">
<ProgressBar.Style>
<Style TargetType="ProgressBar">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ProgressBar">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Indeterminate">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="DeterminateRoot"
Storyboard.TargetProperty="Opacity"
To="0.5"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ProgressBar.Style>
</ProgressBar>
Run Code Online (Sandbox Code Playgroud)
但仍然没有果汁。
xaml progress-bar windows-store-apps windows-8.1 windows-phone-8.1
我有一个从左到右显示的进度条。我需要制作另一个相同风格的进度,但将从右到左显示。
这是我的风格定义:
progress, progress[role] {
-webkit-appearance: none;
appearance: none;
border: none;
background-size: auto;
height: 50px;
width: 100%;
padding-top: 10px;
}
progress[value]::-webkit-progress-bar {
background-color: grey;
border-radius: 2px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset;
}
progress[value]::-webkit-progress-value {
background-image:
-webkit-linear-gradient(-45deg,
transparent 33%, rgba(0, 0, 0, .1) 33%,
rgba(0,0, 0, .1) 66%, transparent 66%),
-webkit-linear-gradient(top,
rgba(255, 255, 255, .25),
rgba(0, 0, 0, .25)),
-webkit-linear-gradient(left, #09c, #f44);
border-radius: 2px;
background-size: 35px 20px, 100% 100%, 100% 100%;
}
.valuebar {
position: relative;
} …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用androidx,我在某处使用ContentLoadingProgressBar,但我无法更改默认颜色。
我试过android:indeterminateTint但无能为力。
如果有人对此有任何想法,请建议
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/progress"
android:layout_width="@dimen/_30sdp"
android:layout_height="@dimen/_30sdp"
android:indeterminateTint="@android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Run Code Online (Sandbox Code Playgroud) 使用Material Design 库中的TextInputLayout,我们可以使用各种结束图标模式进行密码编辑、文本清除和自定义模式。此外,如果我们使用任何样式,它将自动应用显示打开和关闭 V 形的特殊结束图标模式。Widget.MaterialComponents.TextInputLayout.*.ExposedDropdownMenu
各种图标模式示例:
鉴于结束图标的各种用例,我们决定在 中使用加载指示器InputTextLayout,使其看起来像这样:
应该如何着手实施呢?
android loading android-progressbar progress-bar material-components-android
我想用这种方法捕捉图像
DISM.exe /capture-ffu /imagefile=e:\WinOEM.ffu /capturedrive=\\.\PhysicalDrive0 /name:disk0 /description:"Windows 10 FFU"
Run Code Online (Sandbox Code Playgroud)
参考:
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/deploy-windows-using-full-flash-update--ffu
Run Code Online (Sandbox Code Playgroud)
在powershell中我用这种方式
& DISM.exe /capture-ffu /imagefile=e:\WinOEM.ffu /capturedrive=\\.\PhysicalDrive0 /name:disk0 /description:"Windows 10 FFU"
Run Code Online (Sandbox Code Playgroud)
它在捕获时显示命令窗口。我可以在捕获时创建一个像进度条这样的 GUI 吗?
感谢您的任何建议。
我已经创建了这个 PowerShell 脚本,但我不知道我应该把这个命令放在哪里
& DISM.exe /capture-ffu /imagefile=e:\WinOEM.ffu /capturedrive=\\.\PhysicalDrive0 /name:disk0 /description:"Windows 10 FFU"
Add-Type -assembly System.Windows.Forms
## -- Create The Progress-Bar
$ObjForm = New-Object System.Windows.Forms.Form
$ObjForm.Text = "Image Capturing"
$ObjForm.WindowState = 'Maximized'
$ObjForm.BackColor = "White"
$ObjForm.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedSingle
$ObjForm.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen
## -- Create The Label
$ObjLabel = New-Object System.Windows.Forms.Label
$ObjLabel.Text = "Starting. Please wait ... …Run Code Online (Sandbox Code Playgroud) progress-bar ×10
android ×4
c# ×2
androidx ×1
asp.net ×1
class ×1
css ×1
ffmpeg ×1
freeze ×1
html ×1
loading ×1
material-components-android ×1
percentage ×1
powershell ×1
windows-8.1 ×1
xaml ×1