delphi 线程创建线程_在Delphi中以线程的形式显示主要进度

本文介绍了如何在Delphi中创建线程并显示线程进度,强调了从线程内部更新进度条是错误的,提出通过发送同步消息到主线程来更新进度条。内容包括设置进度条、定义基础线程`TProgressThread`、创建自定义线程`TMyThread`、调整进度条位置的处理程序以及如何从表单启动线程。
摘要由CSDN通过智能技术生成

delphi 线程创建线程

A lot of questions regard threads in Delphi.  

关于Delphi中的线程有很多问题。

One of the more specific questions is how to show progress of the thread.  

更具体的问题之一是如何显示线程进度。

Updating a progressbar from inside a thread is a mistake.

从线程内部更新进度条是一个错误。

A solution to this would be to send a synchronized message to the main thread.

一种解决方案是将同步消息发送到主线程。

This message would then contain the progress of the thread from 0 to 100.

然后,此消息将包含线程从0到100的进度。

1.设置进度条 (1. Setting the progress bar)

The progressbar will be displaying from 0 to 100

进度条将显示为0到100

Property Max = 100

属性最大= 100

Property Min = 0

属性最小值= 0

2.基本线程:TProgressThread (2. The base thread: TProgressThread)

I defined a thread class for sending messages back via a synchronize procedure

我定义了一个线程类,用于通过同步过程将消息发送回去

type
  TProgressProc = procedure (aProgress: Integer) of object; // 0 to 100
 
  TProgres
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值