单击按钮有几个任务。
例如。
是否可以单击按钮显示后,请等待面板或表单,并在完成所有操作后隐藏该面板。
如何同步一对一执行任务。
或任何其他简单的解决方案。
如何将OnMouseWheel两个滚动框添加到同一个表单?我应用了该方法,ScrollBox1但我不知道如何将该方法添加到ScrollBox2
procedure TForm3.FormMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
var
LTopLeft, LTopRight, LBottomLeft, LBottomRight: SmallInt;
LPoint: TPoint;
begin
inherited;
LPoint := ScrollBox1.ClientToScreen(Point(0,0));
LTopLeft := LPoint.X;
LTopRight := LTopLeft + ScrollBox1.Width;
LBottomLeft := LPoint.Y;
LBottomRight := LBottomLeft + ScrollBox1.Width;
if (MousePos.X >= LTopLeft) and
(MousePos.X <= LTopRight) and
(MousePos.Y >= LBottomLeft)and
(MousePos.Y <= LBottomRight) then
begin
ScrollBox1.VertScrollBar.Position :=
ScrollBox1.VertScrollBar.Position - WheelDelta;
Handled := True;
end;
end;
Run Code Online (Sandbox Code Playgroud) 我刚刚在 Excel VBA 中编写了这个简单的宏,用于合并一组选定的单元格:
Sub Macro_Merge()
Dim Temp As String
Dim S As Variant
Temp = ""
For Each S In Selection
If Temp = "" Then
Temp = CStr(S.Value)
Else:
Temp = Temp + "," + CStr(S.Value)
End If
Next
Selection.Merge
Selection.Value = Temp
Selection.VerticalAlignment = xlTop
End Sub
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我总是看到那个烦人的对话框,警告我在合并时丢失数据(这正是我在宏中试图避免的情况)。
我可以摆脱该对话框,配置Application的DisplayAlerts属性:
Application.DisplayAlerts = False
Selection.Merge
Selection.Value = Temp
Application.DisplayAlerts = True
Run Code Online (Sandbox Code Playgroud)
这工作正常。
因此,与Application默认对象一样,我尝试清理我的代码,如下所示:
DisplayAlerts = False
Selection.Merge
Selection.Value = Temp
DisplayAlerts = True …Run Code Online (Sandbox Code Playgroud) 我有这个代码,插入一些没有拉丁字符,然后从IDTCPserverTo 发送它idTcpclient
LVU := TStringList.Create;
LVU.Add('?????');
try
if (LVU.Count > 0) then
begin
memorylist := TMemoryStream.Create;
try
LVU.SaveToStream(memorylist);
memorylist.Position := 0;
AContext.Connection.IOHandler.DefStringEncoding := IndyTextEncoding_UTF8;
AContext.Connection.IOHandler.LargeStream := true;
AContext.Connection.IOHandler.Write(memorylist, 0, true);
finally
memorylist.Free;
end;
end;
finally
LVU.Free;
end;
Run Code Online (Sandbox Code Playgroud)
但是当客户收到它时,它会将ms里面的文字记为'???????' 可能是什么问题 ?我已经将连接编码设置为utf8
我在Ubuntu上运行这个服务器.当我在Windows上尝试服务器时,我得到了正常的文本.
这就是我在客户端读取流的方式
FMSFROMCALL := TMemoryStream.Create;
FTCP.Socket.LargeStream := True;
FTCP.Socket.ReadStream(FMSFROMCALL, -1, false);
FMSFROMCALL.Position := 0;
Run Code Online (Sandbox Code Playgroud) 这是我第一次尝试创建一个组件,我想我会从一个非常基本的LED(灯泡而不是文本)开始,在阅读了几篇文章后我想出了以下代码(这是有效的),我关闭了IDE (XE10.1 update2)当尝试在新的空白空应用程序中使用该组件时,IDE在添加控件时崩溃可以帮助任何人:
unit ZaxLED;
interface
uses
Windows, Messages, Controls, Forms, Graphics, ExtCtrls, Classes, math;
type
TZaxLED = class(TGraphicControl)
private
{ Private declarations }
FColorOn: Tcolor;
FColorOff: Tcolor;
Color: Tcolor;
FStatus: Boolean;
FOnChange: TNotifyEvent;
procedure SetColorOn(Value: Tcolor);
procedure SetColorOff(Value: Tcolor);
function GetStatus: Boolean;
procedure SetStatus(Value: Boolean);
protected
{ Protected declarations }
procedure Paint; override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
published
{ Published declarations }
property width …Run Code Online (Sandbox Code Playgroud) 我在 Delphi 10.1 的多设备应用程序(在 Windows 上)中遇到问题。我有一个StringGrid(连接到数据库),我可以更改行的背景颜色,但问题是单元格之间有“填充”(灰色/银色)。
在onformCreate我定义中:
stringgrid1.DefaultDrawing := False;
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
procedure Tlist_form.StringGrid1DrawColumnCell(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF;
const Row: Integer; const Value: TValue; const State: TGridDrawStates);
var aRowColor: TBrush;
begin
aRowColor := Tbrush.Create(TBrushKind.Solid,TAlphaColors.Alpha);
if (stringgrid1.Cells[7,row]='1') then
aRowColor.Color := TAlphaColors.Green
else
aRowColor.Color := TAlphaColors.Red;
Canvas.FillRect(Bounds, 0, 0, [], 1, aRowColor);
Column.DefaultDrawCell(Canvas, Bounds, Row, Value, State);
aRowColor.free;
end;
Run Code Online (Sandbox Code Playgroud)
在 Delphi 6 中我从未遇到过这个问题,而且我不知道如何解决它。谢谢。
delphi background-color firemonkey stringgrid delphi-10.1-berlin
我正在写一个包含记录数组的简单对象.就像发票一样.(ID,日期,客户名称和有关物品的记录数组).
type
Trows = record
private
Fcode: string;
Qty: Double;
cena: Currency;
procedure Setcode(const value: string);
public
property code: string read Fcode write SetCode;
end;
Tcart = class(TObject)
private
Frow: array of Trows;
function Getrow(Index: Integer): Trows;
procedure Setrow(Index: Integer; const Value: Trows);
public
ID: integer;
CustName: string;
Suma: currency;
Payed: boolean;
constructor Create(const Num: Integer);
destructor Destroy;
function carttostr: string;
procedure setcode(Index: integer;val: string);
property Row[Index: Integer]: Trows read Getrow write setrow;
end;
Run Code Online (Sandbox Code Playgroud)
一切似乎很好,因为我试图改变一条记录的价值.我找到了3种方法.首先,第二个工作正常,但我想简化修改此记录值的代码,如下所示:
cart.row[0].code:='333';
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
我错过了什么?
这是代码:
procedure …Run Code Online (Sandbox Code Playgroud) 我的问题是,如何将任何场景统一设置为第一个场景(意味着游戏开始时它将首先打开)。
当我开始统一制作游戏时,我没有制作主菜单,而是制作了级别 1,因此当游戏打开时,它会通过显示级别 1 直接启动游戏。
那么我怎样才能将我的主菜单设置为第一个场景
我是德尔福的新手,我需要一些帮助。
\n我有一个程序,一个背景颜色变换器,带有TColorDialog. ColorDialog否则效果很好,但是当我关闭而不从中选择颜色时,就会出现问题。然后背景变为黑色,并且还将黑色保存为颜色“0”.ini。
我的代码:
\nprocedure TEinstellungenF.BtnBackgroundClick(Sender: TObject);\nvar filename:String;\nini:TIniFile;\nbegin // Speichert die im ColorDialog ausgew\xc3\xa4hlten Background Farben in der Ini\n filename := ExtractFilePath(ParamStr(0)) + 'Einstellungen.ini';\n ini := TIniFile.Create(filename);\n ColorDialog1.Execute();\n try\n ini.WriteInteger('Farben','Hintergrundfarbe', ColorDialog1.Color);\n finally\n ini.Free;\n end;\n\n FrmMain.Color := TColor(Ini.ReadInteger('Farben','Hintergrundfarbe',ColorDialog1.Color));\n Color := TColor(Ini.ReadInteger('Farben','Hintergrundfarbe',ColorDialog1.Color));\nend;``` \nRun Code Online (Sandbox Code Playgroud)\n 这是我的代码,除了图标之外都有效
procedure TForm1.FormCreate(Sender: TObject);
var item : TMenuItemInfo;
begin
with item do
begin
cbSize := SizeOf(MenuItemInfo);
fMask := MIIM_TYPE or MIIM_ID;
fType := MFT_STRING;
wID := 180;
dwTypeData := PChar('Test');
cch := 4;
hbmpItem := Image1.Picture.Bitmap.Handle; //Image1 is TImage
end;
InsertMenuItem(GetSystemMenu(Handle, FALSE),0,true,item);
end;
Run Code Online (Sandbox Code Playgroud) delphi ×8
firemonkey ×2
arrays ×1
assign ×1
c# ×1
colordialog ×1
components ×1
crash ×1
delphi-xe8 ×1
excel ×1
excel-365 ×1
ide ×1
indy10 ×1
records ×1
stringgrid ×1
vba ×1
vcl ×1
windows ×1