我需要一个进度条来响应可可下载的完成百分比.我认为这可能会使用像NSProgressindicator和NSTask这样的东西.我不确定是否有一种"官方"方法可以在可可中下载文件,因为到目前为止我只使用了curl和NSTask.谢谢你的回复.
我正在尝试在表单上显示进度条,但由于某种原因,表单在进程结束之前实际上是不可见的,并且在进程结束时它被关闭(或者换句话说,表单是只开一个瞬间).如何在流程开始时显示表单?
注意:我的代码可能不是100%正确,我只是因为保密原因而试图使它与我自己的不同.
public void SpawnPizzaProgressBarForm(object sender, EventArgs e)
{
FormPizzaProgressBar Form = new FormPizzaProgressBar();
Form.ShowDialog();
}
...
public void ProgressBarForm_Load(object sender, EventArgs e)
{
Pizza = new Pizza();
Pizza.Eat(PizzaEatingProgressBar);
this.Close();
}
...
public void Eat(ProgressBar PizzaEatingProgressBar)
{
foreach(var Slice in Pizza)
{
Slice.Clear(); //
PizzaEatingProgressBar.Value = (Slice.Index / Pizza.Count())*100
}
}
Run Code Online (Sandbox Code Playgroud) 在LinearLayout有一个WebView和ProgressBar元素.
这WebView是全屏.
我试着展示什么ProgressBar时候WebView加载东西.
但似乎ProgressBar被覆盖WebView,因此不可见.
如果我设置WebView为隐形,我可以看到ProgressBar.
那么我怎样才能展示出ProgressBar最重要的 WebView?
我有一个方法负责将内存中的immes保存到硬盘驱动器,最后会返回一个布尔值.现在我已经创建了一个进度条.但我真的不知道我怎么能以这种方法为进度条连接这个方法,只要该方法保存进度得到更新并显示蓝色条.这是我的代码:
switch(_formatIndex){
case 0:
save.saveImages(_MatVector,0, path);
int pb_pos;pb_pos= SendMessage(_progressBar, PBM_GETPOS, 0, 0);
while(pb_pos<100){
SendMessage(_progressBar, PBM_SETPOS, pb_pos, 0);
pb_pos++;
}
break;
case 1:
save.saveImages(_MatVector,1, path);
break;
}
Run Code Online (Sandbox Code Playgroud) 我正在设计的程序通过获取图像的文件名来生成图像,在cdb中搜索该名称,然后使用该数据库项中的数据生成图片.所有这些都有效.我现在想要做的是添加一个进度条,因为如果你正在做大量的图片,它可能需要一段时间,所以进度条将有助于跟踪它.这是我正在使用的代码,但进度条中的进度不会提前,直到最后我想避免使用后台工作程序(如果我可以).
private void button5_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string folder = folderBrowserDialog1.SelectedPath;
DirectoryInfo dinfo = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
FileInfo[] Files = dinfo.GetFiles("*.jpg");
int count = Files.Length;
int current = 0;
foreach (FileInfo file in Files)
{
string path = Path.GetFileNameWithoutExtension(file.Name);
int cardid = Convert.ToInt32(path);
if (Program.CardData.ContainsKey(cardid))
{
DevPro_CardManager.cardmaker.IMG = LoadBitmap(folderBrowserDialog1.SelectedPath + "//" + file.Name);
string lev = Program.CardData[cardid].Level.ToString();
comboBox2.SelectedItem = lev;
string att = Program.CardData[cardid].Attribute.ToString();
if (att == "1")
{
att = "earth";
}
else if …Run Code Online (Sandbox Code Playgroud) 我正在编写一个C#应用程序,在其中处理文件中的行。该文件可能有2行,30,80,可能超过一百行。
这些行存储在列表中,因此我可以从获取行数myFileList.Count。进度条仅将int值用作参数,因此如果我的行号为50,则可以轻松地执行
int steps = 100/myFileList.Count
progress += steps;
updateProgressBar ( progress );
Run Code Online (Sandbox Code Playgroud)
但是,如果我的文件说61行:100/61 = 1,64,那么int steps它将等于1,并且进度条将停止在61%。如何正确执行此操作?
请参阅:http://codepaste.net/djw3cw 代码
如果异步编程的异步/等待很快就会像Linq一样,我认为这个问题是使用WinForms ProgressBar进行Async/Await的非平凡扩展
虽然代码是最佳的,但我会很高兴用代替代码的指针或答案.
问题是:如何使用asynch/await设置进度条.在过去,我成功使用了Dispatcher.
Please see: http://codepaste.net/djw3cw for the code
What is done: a textbox has any text in it converted to an int, then when
"mybutton1" is clicked, work is done based on the int, for int ms (int =
milliseconds).
During this time, a progressbar "myProgressBar" is shown for
every tenth-percent step
When work is complete, the label/textblock controls are updated
But the below does not work right: the …Run Code Online (Sandbox Code Playgroud) 从我所看到的情况来看,对HTML5进度条的支持仍然很少,并且使它在每个浏览器或操作系统中都显示为相同的方法通常很复杂。
http://www.hongkiat.com/blog/html5-progress-bar/展示了如何在CSS中创建多个伪类,这些类试图影响progress每个浏览器中元素的样式。
progress {
/* style rules */
}
progress::-webkit-progress-bar {
/* style rules */
}
progress::-webkit-progress-value {
/* style rules */
}
progress::-moz-progress-bar {
/* style rules */
}
Run Code Online (Sandbox Code Playgroud)
鉴于样式将完全依赖于实验的兼容性规则,这似乎是一种非常肿的方法。
有关样式化HTML5进度元素的更多信息:https : //css-tricks.com/html5-progress-element/
有没有使用HTML,CSS和Javascript制作通用进度条的更简单的单步解决方案?
我在JQuery中创建了进度条,它应该显示进度.当前代码仅显示百分比值.我希望看到我的进度条从0%开始,然后上升到100%.此外,我希望我的价值在进度条的中心.这是我目前的代码:
xhr: function(){
var xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener("progress", function(evt){
if(evt.lengthComputable){
var percentComplete = evt.loaded / evt.total;
percentComplete = parseInt(percentComplete * 100);
$('.progress').text(percentComplete + '%');
if(percentComplete === 100){
$('.progress').addClass('hide');
console.log("Successfully uploaded!");
}
}
},false);
xhr.addEventListener("progress", function (evt) {
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
console.log(percentComplete);
$('.progress').text(percentComplete + '%');
}
}, false);
return xhr;
}
HTML:
<div class="progress"></div>
CSS:
.progress {
margin-top: 10px;
display: block;
text-align: center;
width: 300px;
height: 20px;
background: #a3bfcc;
transition: width .3s;
}
.progress.hide …Run Code Online (Sandbox Code Playgroud) 我有一个整数。该值一直在减少。我用进度条表示。 结果是我的进度栏从右移到左。
例如:
iProgSize := 9999;
iProg := 9998; //( this is going down from time to time to zero);
Run Code Online (Sandbox Code Playgroud)
9999只是一个示例值,这是随机的。
pBar.MaxValue := iProgSize;
pBar.Value := iProg;
Run Code Online (Sandbox Code Playgroud)
如何使用这种值从左到右移动进度栏?