所以这里的逻辑
为1%="|" 在TLabel和一个"|" 我们需要循环10次
所以达到100%= 100倍"|" 我们需要1000次循环
你可以帮我代码吗?
只需要设置lbl.caption(在循环内)但问题比我想象的要大.我甚至尝试过使用绳索矢量,但是没有这样的东西.我已经阅读了一些页面,尝试了一些功能,如WideString(),UnicodeString(),我知道我不能也不应该在C++ Builder 2010中关闭Unicode.
std::vector <std::string> myStringVec(20, "");
myStringVec.at(0) = "SomeText";
std::string s = "something";
// this works ..
Form2->lblTxtPytanie1->Caption = "someSimpleText";
// both lines gives the same err
Form2->lblTxtPytanie1->Caption = myStringVec.at(0);
Form2->lblTxtPytanie1->Caption = s;
Run Code Online (Sandbox Code Playgroud)
错误:[BCC32错误] myFile.cpp(129):E2034无法将'std :: string'转换为'UnicodeString'
它现在吃了几个小时.有没有"快速和肮脏"的解决方案?它必须工作......
UPDATE
解决了.我混合了STL/VCL字符串类.谢谢TommyA.
我试图使用一个TListView组件来显示相当大的数据列表(如4000行大),并且创建列表的速度非常慢 - 这需要2-3秒,这使得UI全部滞后并且几乎无法使用.
我在TListView.Items内部填充一个BeginUpdate/EndUpdate块,只有预分配的字符串 - 我的意思是:我构建了一个存储所有字符串的列表(没有人类明显的时间),然后我把它们放在TListView中.
我希望在vsReport具有多个列的模式下显示TListView的内容.
代码如下所示:
MyList.Items.BeginUpdate;
for i := 0 to MyCount - 1 do
begin
ListItem := MyList.Items.Add;
ListItem.Caption := StrCaptions[i];
ListItem.SubItems.Add(StrSubItems1[i]);
ListItem.SubItems.Add(StrSubItems2[i]);
end;
MyList.Items.EndUpdate;
Run Code Online (Sandbox Code Playgroud)
我在TListView组件的逻辑中错过了一些其他的黑客攻击吗?或者我应该忘记使用这个组件进行表演?
我的程序正在执行一项耗时的任务,我想在应用程序窗口中间显示一个TImage,但它不会保持在最顶层 - 我的VST始终位于顶部.但是,当我使用TPanel时,它会保持在顶部?如何让我的TImage做到这一点?
事实上,适用于所有控件的解决方案将是出色的:)
谢谢!
如何找出某个VCL组件可以接受的消息列表???
例如,如果我想通过向它发送消息来滚动Memo1,我可能会编写以下代码行,知道备忘录可以接受EM_LINESCROLL
SendMessage(Memo1->Handle,EM_LINESCROLL,-1,0);
//Memo1->Perform(EM_SCROLL,SB_LINEUP,0);
Memo1->Perform(EM_SCROLL,SB_LINEDOWN,0);
Run Code Online (Sandbox Code Playgroud)
如何查找某些VCL comps是否可以接受或不接受消息?
我有这个:
procedure Welcome(user: string; accesslevel: integer);
begin
if accesslevel>= 10 then btCustomers.Text = 'Customer overview';
end;
Run Code Online (Sandbox Code Playgroud)
虽然,当按钮存在于窗体上时,btCustomers被声明为"未声明的标识符".我错过了什么?
PS我知道这应该由OnCreate形式处理,但欢迎程序从外部表单调用.
我有一个Delphi7项目,大约有10个窗口.程序启动时会加载MainWindow.过了一会儿,MainWindow访问项目的另一个窗口,添加listview项目,并在1-2秒内更新它们.然而,在我打开它之后,这个窗口似乎冻结了并且根本没有显示列表视图.
如果我在MainWindow的OnShow过程中有以下命令,它可以工作:
SecondWindow.Show;
SecondWindow.Close;
Run Code Online (Sandbox Code Playgroud)
它没有问题,但似乎不专业.任何想法如何绘制窗口而不显示?
编辑:代码(我使用Indy9)
procedure TMainWindow.ServerSocketExecute(AThread: TIdPeerThread);
begin
/....
if Buffer = 'additem' then begin
Window2.ListView1.Items.Add;
Exit;
// .....
end;
end;
Run Code Online (Sandbox Code Playgroud)
而已.我删除了Window2上的所有计时器,似乎仍然要冻结.如果添加了一个项目或者我第一次尝试打开第二个Windows时,mainWindow会立即冻结.
场景:
问题:
所以我可以这样写
procedure TMyForm.OnMyAction(Sender: TObject);
begin
try
// notify Action Manager that the Action is temporarily disabled
SomeGlobalFlag := True;
// disable the action
(Sender as TAction).Enabled := False;
// do the call
ShellExecAndWait( ... );
finally
// enable the action
(Sender as TAction).Enabled := True;
// allow ActionManager to control the action again
SomeGlobalFlag := False;
end;
end;
Run Code Online (Sandbox Code Playgroud)
有没有更简单的方法?正如这个问题的标题所说 - 我可以阻止执行外部应用程序的输入吗?
我有一些使用Delphi 2010和XE4构建的应用程序,它们在一个线程中使用Synchronize.我认为在Delphi 2010中将Synchronize引入了Delphi.我的线程运行得很好,所以这不是问题.
我的问题是:有没有办法在Delphi 2010之前与Delphi版本"同步"或者以不同的方式询问它,如何在没有Synchronize的情况下更新这些早期版本的Delphi中的GUI控件?
下面显示的代码是实际代码的子集,以减少此帖子的长度.
type
{ A TThread descendent for loading Images from a folder }
TFolderLoadingThread = class(TThread)
private
{ Private declarations }
AspectRatio: double;
protected
{ Protected declarations }
procedure Execute; override;
public
{ Public declarations }
constructor Create(CreateSuspended: Boolean);
end;
procedure TFolderLoadingThread.Execute;
{ Load images ImageEnView in the thread. }
begin
inherited;
{ Free the thread onTerminate }
FreeOnTerminate := True;
if not Terminated then
begin
{ Set the Progressbar.Max Value }
**Synchronize**(
procedure
begin …Run Code Online (Sandbox Code Playgroud) 有一个我的vcl应用程序.在表单中,有一个StringGrid.我想设置列标题高度,但我不知道它是如何做的.所以问题是:如何设置StringGrid列标题自动行高,因为列行宽不确定
vcl ×10
delphi ×9
c++builder ×2
delphi-7 ×2
c++ ×1
delphi-2010 ×1
delphi-xe4 ×1
indy ×1
modal-dialog ×1
progress-bar ×1
stayontop ×1
timage ×1
tpanel ×1