当前位置:首页 > 代码 > 正文

c进度条代码(c++进度条)

admin 发布:2022-12-20 00:07 152


今天给各位分享c进度条代码的知识,其中也会对c++进度条进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

求C语言,如果、判断、如果真、编辑框、按钮、进度条、标签翻译成C语言的源代码,要全部哦

#includewindows.h

#includestdio.h

int main (void)

{

int a;

if (a == 1)printf ("1"); '判断语句 相当于易语言里的如果 不要下面的else就是如果真

else printf ("2");

//////////////////////////////////////

按钮 进度条 窗口的创建用代码的话需要用GDI画 建议先学基本的输出

}

如何用纯CSS编写一个实用的进度条

1、写一个样式为.containe的div用来包含进度条,其次是用样式为.title的div来包裹标题。

 

2、接下来,添加样式为.bar的di来包含填充和未填充的进度条样式。最后,在.bar里添加样式为.bar-unfill

和.bar-fill的span标签。

Plain

 

3.简单的进度条的CSS代码.container 类里将 width 定义为 30% 使进度条能够自适应。放一些简单的 border-radius 之类的属性在我们的 .title 类里以修改顶部和底部的左边的边框弧度,创建一个简单明了的平板式设计。

.container {

width:30%;

margin:0 auto

}

.title {

background:#545965;

color:#fff;

padding:15px;

float:left;

position:relative;

-webkit-border-top-left-radius:5px;

-webkit-border-bottom-left-radius:5px;

-moz-border-radius-topleft:5px;

-moz-border-radius-bottomleft:5px;

border-top-left-radius:5px;

border-bottom-left-radius:5px

}

4.首先建一个白色的背景

.bar-unfill {height:15px;display:block;background:#fff;width:100%;border-radius:8px}

5.定义进度条的样式,先令他的宽度为 100% ,因为这也会应用于定义和未定义的部分。所以在我们的 .bar-fill 的类里,令他的宽度为 0 作为起始的宽度,添加CSS3的 transition 属性使动画效果更加流畅,最后,我们将添加CSS3里的 animation 属性,定义动画的名字,和 duration 和 animation-iteration-count 属性。

.bar-fill {

height:15px;

display:block;

background:#45c9a5;

width:0;

border-radius:8px;

-webkit-transition:width .8s ease;

-moz-transition:width .8s ease;

transition:width .8s ease;

-webkit-animation:progressbar 7s infinite;

animation:progressbar 7s infinite

}

6.使用CSS3里的 @keyframe 规则来设置宽度从 0 变化到 100% 。你也能定制你自己喜欢的变化。

@-webkit-keyframes progressbar { 

from {

width:0

}

to {

width:100%

}

}

/* Standard syntax */

@keyframes progressbar {

from {

width:0

}

to {

width:100%

}

}

7.条纹进度条,应该把 .bar-fill 重新命名为 .bar-fill-stripes 。使用 backgrou-image 属性里的 linear-gradient 同时声明它的颜色。剩余的CSS3动画效果也是和上述相同,看下面的代码:

.bar-fill-stripes {

height:15px;

display:block;

background:#e74c3c;

width:0;

border-radius:8px;

background-image:linear-gradient(-45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2)   50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);

-webkit-transition:width .8s ease;

-moz-transition:width .8s ease;

transition:width .8s ease;

-webkit-animation:progressbar 7s infinite;

animation:progressbar 7s infinite

}

追踪

Tracker

8.最后产生动画效果

.track-wrap {

position:relative;

top:-18px;

-webkit-animation:progressbar2 7s infinite;

animation:progressbar2 7s infinite

}

.track {

height:20px;

display:block;

background:#e74c3c;

width:20px;

border-radius:10px;

position:relative;

left:-12px

}

@-webkit-keyframes progressbar2 {

from {

left:0

}

to {

left:100%

}

}

/* Standard syntax */

@keyframes progressbar2 {

from {

left:0

}

to {

left:100%

}

C#进度条怎么用 / C#progressBar的用法

创建进度条窗口2、在其他窗口中调用方法ShowProcess(int percent,string message)

复制代码 代码如下:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Mes.Core;

namespace HCMDoImport

{

public partial class ProcessBarForm : BaseForm

{

int processPercent = 0;

string message = "";

public string Message

{

get { return message; }

set

{

message = value;

this.label1.Text = message;

}

}

public int ProcessPercent

{

get { return processPercent; }

set

{

processPercent = value;

if (processPercent = 100)

this.Close();

this.progressBar1.Value = processPercent;

}

}

public ProcessBarForm()

{

InitializeComponent();

}

/// summary

/// 更新进度

/// /summary

/// param name="percent"进度,小于等于100/param

/// param name="message"消息/param

public void ShowProcess(int percent,string message)

{

this.Show();

this.ProcessPercent = percent;

this.Message = message;

this.progressBar1.Refresh();

this.label1.Refresh();

}

private void ProcessBarForm_Load(object sender, EventArgs e)

{

this.Cursor = Cursors.WaitCursor;

}

private void ProcessBarForm_FormClosing(object sender, FormClosingEventArgs e)

{

this.Cursor = Cursors.Default;

}

}

}

可以参考:

vc6.0里MFC进度条如何使用

演练CProgress

7.1

进度条的主要功能

进度条控制(Progress

Control)主要用来进行数据读写、文件拷贝和磁盘格式等操作时的工作进度提示情况,如安装程序等,伴随工作进度的进展,进度条的矩形区域从左到右利用当前活动窗口标题条的颜色来不断填充。

进度条控制在MFC类库中的封装类为CProgressCtrl,通常仅作为输出类控制,所以其操作主要是设置进度条的范围和当前位置,并不断地更新当前位置。进度条的范围用来表示整个操作过程的时间长度,当前位置表示完成情况的当前时刻。SetRange()函数用来设置范围,初始范围为0-100,

SetPos()函数用来设置当前位置,初始值为0,SetStep()函数用来设置步长,初始步长为10,StepIt()函数用来按照当前步长更新位置,OffsetPos()函数用来直接将当前位置移动一段距离。如果范围或位置发生变化,那么进度条将自动重绘进度区域来及时反映当前工作的进展情况。

进度条的对象结构

进度条控制的建立方法

CProgressCtrl

ProgressCtrl

建立进度条控制对象结构

Create

建立进度条控制对象并绑定对象

进度条控制类CprogressCtrl::Create的调用格式如下:

BOOL

Create(

DWORD

dwStyle,

const

RECT

rect,

CWnd*

pParentWnd,

UINT

nID

);

其中参数dwStyle用来确定进度条控制的控制风格;参数rect用来确定进度条控制的大小和位置;参数pParentWnd用来确定进度条父窗口指针;参数nID用来确定进度条控制的控制符ID值。

7.2

进度条控制的类属性

进度条控制的类属性包括设置进度条最大最小控制范围SetRange、设置进度条当前位置

SetPos、设置进度条当前位置偏移值OffsetPos和设置进度条控制增量值SetStep。

7.3

进度条控制的操作方法

进度条控制的操作方法主要是使进度条控制并重绘进度条的StepIt函数。

进度条控制的应用技巧示例

1、利用应用程序向导AppWizard生成基于对象框的应用程序CProgDlg;

2、在对话框中设置进度条和静态文本控制,其ID分别为IDC_PROG和IDCPERCENT;

在对话框初始代码中增加控制的范围和位置:

在ProgDlg.h中设置两个数据成员,用来表示进度条的最大值和步长:

//ProgDlg.h

class

CProgDlg:public

Cdialog

{

......//其它代码

public:

int

m_nMax,m_nStep;

......

//其它代码

}

(2)在ProgDlg.cpp中设置初始状态

BOOL

CProgDlg::OnInitDialog()

{

Cdialog::OnInitDialog();

......//其它代码

//TODO:Add

extra

initialization

here

CProgressCtrl

*pProgCtrl=(CProgressCtrl*)GetDlgItem(IDC_PROG);

pProgCtrl-SetRange(0,200);//设置进度条范围

......//其它代码

m_nMax=200;

m_nStep=10;

SetTimer(1,1000,NULL);//设置进度条更新时钟

return

TRUE;

}

(3)完善WM_TIMER消息处理,使进度条按照当前步长进行更新,同时完成进度条的百分比显示:

void

CProgDlg::OnTimer(UINT

nIDEvent)

{

//TODO:Add

your

message

handler

CProgressCtrl

*pProgCtrl=(CProgressCtrl*)GetDlgItem(IDC_PROG);

int

nPrePos=pProgCtrl-StepIt();//取得更新前位置

char

test[10];

int

nPercent=(int)(((nPrePos+m_nStep)/m_nMax*100+0.5);

wsprintf(test,%d%%,nPercent);

GetDlgItem(IDC_PERCENT)-SetWindowText(text);

Cdialog::OnTimer(nIDEvent);

}

C语言做一个百分比进度条

1.c和js通信 可以用xml来解决,这个就不详细讲了 2.进度条,使用css百分比做,比如: html code div id="warp" style="width:100px;height:10px;border:1px solid #eee;background:#000;overflow:hidden"!-#warp用以包裹进度以及显示这个进度条-div id="point" style="width:[color=#ff0000]90%[/color];background:#44a;height:10px;"/div!-#point利用百分比控制实现和进度条一直的效果,后面需要的是利用js做width的值的赋值操作如果你的c中不断有当前进度进行输出,那可以在页面中不断调用js函数读取该输出变量,然后调整进度条,

C语言进度条

程序1:#include "stdio.h"

#include dos.h

#include conio.h

/*去光标函数*/

void no_text_cursor(void)

{

union REGS r;

r.h.ah=1;

r.h.ch=32;

int86(0x10,r,r);

}

main()

{

int i;

int bfb;

char b=219;

char c='%';

for(i=1;i=60;i++)

{ gotoxy(i,1); /*为了能在进度条和百分比之间变动*/

no_text_cursor();

delay(45000);/*前后两个delay是为了让滚动更好看,流畅*/

printf("%c",b);

delay(45000);

gotoxy(31,2); /*为了能在进度条和百分比之间变动*/

bfb=((i*10)/6);

printf("%d",bfb);

gotoxy(34,2);

printf("%");

}

printf("\nLoading Successful!");

getch();

}程序2:#includegraphics.h

main()

{

int gdriver=DETECT,gmod,i;

/*registerbgidriver(EGAVGA_driver);*/

initgraph(gdriver,gmod,"");

setlinestyle(0,0,2);

rectangle(3,215,637,250);

setcolor(RED);

sleep(3);

for(i=0;i632;++i)

{

if(i==631)break;

line(5+i,216,5+i,249);

delay(2888);

}

getch();

closegraph();

} 以上程序均在TC2.0下通过

关于c进度条代码和c++进度条的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/31602.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载