在WinForm开发中,在处理大量数据时不免会有耗时较长的操作,如果将这些操作放在主线程里,软件界面会有较长时间的“无响应”,降低了用户体验,常用的解决方式是加上进度条。
实现思路--------------------------------------------------------------------------------使用BackgroundWorker(已经封装好的线程工具)控件在后台线程执行费时的操作,在主线程中打开一个进度条窗体显示进度。
实现步骤--------------------------------------------------------------------------------第0步:创建一个具有进度条的窗体,以显示进度新建窗体ProcessForm,设置属性FormBorderStyle为None,添加一个ProcessBar控件,如下图所示:进度条窗体PrcessBar的Style属性设置为MarQuee。
在ProcessForm添加如下公共属性:?1234567891011121314151617181920212223//////设置提示信息///publicstringMessageInfo{set{this.labelInfor.Text=value;}}//////设置进度条显示值///publicintProcessValue{set{this.progressBar1.Value=value;}}//////设置进度条样式///publicProgressBarStyleProcessStyle{set{this.progressBar1.Style=value;}}第1步:创建进度条管理类ProcessOperator在该类中添加如下字段:?12privateBackgroundWorker_backgroundWorker;//后台线程privateProcessForm_processForm;//进度条窗体添加如下公共属性、方法和事件:?123456789101112131415161718192021222324252627282930#region公共方法、属性、事件//////后台执行的操作///publicActionBackgroundWork{get;set;}//////设置进度条显示的提示信息///publicstringMessageInfo{set{_processForm.MessageInfo=value;}}//////后台任务执行完毕后事件///publiceventEventHandlerBackgroundWorkerCompleted;//////开始执行///publicvoidStart(){_backgroundWorker.RunWorkerAsync();_processForm.ShowDialog();}#endregion其中,属性BackgroundWork可以指向一个无参数的方法,这里(客户端代码)用来指向要在
2024/4/20 19:27:33 34KB Winform 进度条 Background Worker
1
使用c++实现的顺序表:多文件编程,层次清晰,函数有注释SeqList();//构造函数,存储的元素个数设为0boolsetLength(size_tlength);//设置已经存储的元素个数booladdElement(ElemTypeelement);//把某个元素添加到顺序表末尾booladdElement(ElemTypeelement,size_tn);//插入一个元素,使其成为第n个元素,其余元素后移booldelElement();//删除所有的元素booldelElement(size_tn);//删除第n个元素booldelElement(stringelementDetailType,stringelementDetail);//通过某个元素细节找到元素,把这个元素删除boolreplaceElement(ElemTypeelement,size_tn);//使用一个元素,替换掉第n个元素boolswapElement(size_tn1,size_tn2);//把第n1个元素和第n2个元素交换ElemType*getElement();//得到数组头的指针ElemType*getElement(size_tn);//得到第n个元素的指针size_tgetLength();//得到存储的元素个数size_tgetMaxSize();//得到顺序表容量boolshowElementDetail();//输出所有的元素细节boolshowElementDetail(size_tn);//输出第n个元素的细节boolshowElementDetail(stringelementDetailType,stringelementDetail);//通过某个元素细节找到元素,输出元素所有细节size_tfindElement(stringelementDetailType,stringelementDetail);//通过某个元素细节找到元素位置staticintinputAInt(intmin=0,intmax=9,intdefaultValue=-1);//从键盘读取,限制为一个min到max间的整数,非法情况返回defaultValuevoidstartControlLoop();//打开控制界面~SeqList();//析构函数
2024/2/19 19:14:08 50KB 数据结构 顺序表 c++ 代码
1
VirtualTapeLibraryconsistsofseveralcomponents.LLD-Alowleveldriverimplementedasakernelmodule-mhvtlTargetdevices-Daemonsvtltape(1)andvtllibrary(1)whichimplementSCSItargetdevice(s)inuser-spaceUtilitycommandsmktape(1),vtlcmd(1)Andstartupscriptsbuild_library_config(1),make_vtl_devices(1)
2024/2/13 3:12:24 317KB MHVTL;
1
多旅行商matlab实验源码实现了三种多旅行商问题%MTSPOF_GAFixedOpenMultipleTravelingSalesmenProblem(M-TSP)GeneticAlgorithm(GA)%Findsa(near)optimalsolutiontoavariationofthe"open"M-TSPby%settingupaGAtosearchfortheshortestroute(leastdistanceneeded%foreachsalesmantotravelfromthestartlocationtounique%individualcitiesandfinallytotheendlocation)%%Summary:%1.Eachsalesmanstartsatthefirstpoint,andendsatthelast%point,buttravelstoauniquesetofcitiesinbetween(noneof%themclosetheirloopsbyreturningtotheirstartingpoints)%2.Exceptforthefirstandlast,eachcityisvisitedbyexactlyonesalesman%%Note:TheFixedStartistakentobethefirstXYpointandtheFixedEnd%istakentobethelastXYpoint%%Input:%XY(float)isanNx2matrixofcitylocations,whereNisthenumberofcities%DMAT(float)isanNxNmatrixofcity-to-citydistancesorcosts%SALESMEN(scalarinteger)isthenumberofsalesmentovisitthecities%MIN_TOUR(scalarinteger)istheminimumtourlengthforanyofthe%salesmen,NOTincludingthestartpointorendpoint%POP_SIZE(scalarinteger)isthesizeofthepopulation(shouldbedivisibleby8)%NUM_ITER(scalarinteger)isthenumberofdesirediterationsforthealgorithmtorun%SHOW_PROG(scalarlogical)showstheGAprogressiftrue%SHOW_RES(scalarlogical)showstheGAresultsiftrue%%Output:%OPT_RTE(integerarray)isthebestroutefoundbythealgorithm%OPT_BRK(integerarray)isthelistofroutebreakpoints(thesespecifytheindices%intotherouteusedtoobtaintheindividualsalesmanroutes)%MIN_DIST(scalarfloat)isthetotaldistancetraveledbythesalesmen%%Route/BreakpointDetails:%Ifthereare10citiesand3salesmen,apossibleroute/break%combinationmightbe:rte=[56942837],brks=[37]%
1
Go的终端进度栏安装gogetgithub.com/cheggaaa/pb/v3v1栏的文档可快速开始packagemainimport( "time" "github.com/cheggaaa/pb/v3")funcmain(){ count:=100000 //createandstartnewbar bar:=pb.StartNew(count) //startbarfrom'default'template //bar:=pb.Default.Start(count) //startbarfrom'simple'template //bar:=pb.Simple.Start(count) //startbarfrom'full'template //bar:=pb.Full.Start(count) fori:=0;i<count;i++{ bar.Increment() time.Slee
2023/9/26 4:08:08 44KB go terminal progress-bar GoGo
1
简易版扫雷程序代码publicclassMineSweeperGame2extendsApplication{Cell[][]cell;inttotalMines=0;intmarkBomb=0;//总的地雷数量,简单会有10个,一般会有40个,困难99个intshowMines=10;Strings=String.valueOf(showMines);Labeltips=newLabel("Gameisrunning!");LabelshowMineNum=newLabel("mines:"+s);publicvoidstart(StageprimaryStage){StagestartStage=newStage();//选择按钮的界面ButtonstartButton=newButton("RESTART");Buttonchooseeasy=newButton("EASY(10mines)");Buttonchoosenormal=newButton("NORMAL(40mines)");Buttonchoosehard=newButton("HARD(99mines)");BorderPaneprimaryPane=newBorderPane();HBoxstartPane=newHBox(15);StackPanetopButtonPane=newStackPane(startButton);StackPanetopButtonPane2=newStackPane(showMineNum);StackPanebuttomPane=newStackPane(tips);HBoxtopPane=newHBox(50);topPane.getChildren().addAll(topButtonPane,topButtonPane2);primaryPane.setTop(topPane);tips.setStyle("-fx-border-color:red;-fx-background-color:white;");showMineNum.setStyle("-fx-border-color:black");primaryPane.setBottom(buttomPane);buttomPane.setPadding(newInsets(15,15,15,15));topPane.setPadding(newInsets(15,15,15,15));startPane.setPadding(newInsets(15,15,15,15));startPane.getChildren().add(chooseeasy);startPane.getChildren().add(choosenormal);
2023/8/24 13:54:33 12KB java
1
WelcomeWelcometoXGBoostWithPython.ThisbookisyourguidetofastgradientboostinginPython.YouwilldiscovertheXGBoostPythonlibraryforgradientboostingandhowtouseittodevelopandevaluategradientboostingmodels.Inthisbookyouwilldiscoverthetechniques,recipesandskillswithXGBoostthatyoucanthenbringtoyourownmachinelearningprojects.GradientBoostingdoeshaveasomefascinatingmathunderthecovers,butyoudonotneedtoknowittobeabletopickitupasatoolandwielditonimportantprojectstodeliverrealvalue.Fromtheappliedperspective,gradientboostingisquiteashallowfieldandamotivateddevelopercanquicklypickitupandstartmakingveryrealandimpactfulcontributions.Thisismygoalforyouandthisbookisyourtickettothatoutcome.
2023/6/14 15:42:44 2.07MB machine lear mastery xgboost
1
OFDM实现源码instructions:Therearetwomainprograms:_thefirstonesends400integers(representingasinewave)._thesecondonesendspictures.Tousethem,youhavetorunthesametypeoneachside.---------------------------------------------------------------------------------Receiver:Executables:GotofolderexecutablesandchoosefolderforSineorPicture.Runthe.exe!SourceCode:Thesourcecodeforthedspcardisinthefolder.\DSP\OpenprojectfromCCS.dsk_app.cisthemainprogram.--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Transmitter:I.SimpleSinusoid1.loadprogram:.\black05\executables\transmitter\transmitter_sine.exeThiswillloadthedsk_app_sine.outandstarttheGUI.2.RUNTheprogramwillsendcodedsamplesofa400pt.sinewavetotheright-outchannelofthetransmitter.Thereceivedsamplesarewrittentobuffer:finalData.Displaythe400samplesasunsignedintegers,andcomparetheresult.II.Picture1.loadprogram:.\black05\executables\transmitter\transmitter.exeThiswillloadthedsk_app_pic.outandstarttheGUI.2.Chooseapicturefrom:.\black05\executables\transmitter\res
2023/6/4 20:12:55 5.6MB OFDM DSP CCS
1
SpringCloudDemo亲测可用SpringCloud是一系列框架的有序群集.首要的小弟有:SpringCloudConfig、SpringCloudNetflix(Eureka、Hystrix、Zuul、Archaius…)、SpringCloudBus、SpringCloudforCloudFoundry、SpringCloudCluster、SpringCloudConsul、SpringCloudSecurity、SpringCloudSleuth、SpringCloudDataFlow、SpringCloudStream、SpringCloudTask、SpringCloudZookeeper、SpringCloudConnectors、SpringCloudStarters、SpringCloudCLI
2023/4/10 9:53:15 78KB SpringCloud SpringCloudD
1
pic-jvm内存模子,其余流程。
ThankyoufordownloadingIntelliJIDEA!Yourdownloadshouldstartshortly.Ifitdoesn't,pleaseusethedirectlink.
2023/3/25 5:17:20 5.95MB jvm
1
共 21 条记录 首页 上一页 下一页 尾页
在日常工作中,钉钉打卡成了我生活中不可或缺的一部分。然而,有时候这个看似简单的任务却给我带来了不少烦恼。 每天早晚,我总是得牢记打开钉钉应用,点击"工作台",再找到"考勤打卡"进行签到。有时候因为工作忙碌,会忘记打卡,导致考勤异常,影响当月的工作评价。而且,由于我使用的是苹果手机,有时候系统更新后,钉钉的某些功能会出现异常,使得打卡变得更加麻烦。 另外,我的家人使用的是安卓手机,他们也经常抱怨钉钉打卡的繁琐。尤其是对于那些不太熟悉手机操作的长辈来说,每次打卡都是一次挑战。他们总是担心自己会操作失误,导致打卡失败。 为了解决这些烦恼,我开始思考是否可以通过编写一个全自动化脚本来实现钉钉打卡。经过一段时间的摸索和学习,我终于成功编写出了一个适用于苹果和安卓系统的钉钉打卡脚本。
2024-04-09 15:03 15KB 钉钉 钉钉打卡