我怎么能用delphi xe做这个转换?我尝试过使用libiconv2但没有用.
我得到了一个jpeg图像,其中1020x780,我试图将其调整为111x85(这是比例),但它出现像素化.
我只是尝试过
a)将图像分配给TImage组件并设置Scaled/Resize属性.
b)这里的调整大小代码http://www.delphigroups.info/2/4/313095.html
c)这里的调整大小代码http://www.swissdelphicenter.ch/torry/showcode.php?id=1896
然而,他们都出现像素化.
如果我在Photoshop中调整大小,那就好了.获得好处将是理想的,但是我知道他们花了很多时间/代码来调整大小,所以甚至中间的东西也会很棒.
有什么建议?
代码我正在使用(XE):
// Encrypt a string and return the Base64 encoded result
function Encrypt(DataToEncrypt: ansistring):ansistring;
const Key: Ansistring = 'keykey';
KeySize = 32; // 32 bytes = 256 bits
BlockSize = 16; // 16 bytes = 128 bits
var
Cipher : TDCP_rijndael;
Data: ansistring;
IV: array[0..15] of byte; // the initialization vector
i:Integer;
begin
// Pad Key, IV and Data with zeros as appropriate
FillChar(IV,Sizeof(IV),0); // make the IV all zeros
Data := PadWithZeros(DataToEncrypt,BlockSize);
for i := 0 to (Length(IV) - …Run Code Online (Sandbox Code Playgroud) 是否有IDE可以打开传统的Delphi 5项目?
Delphi XE似乎不支持delphi 5.
我编写了一个受网络困扰的程序.它用于多线程.问题是线程输出.该计划是混合的.并且输出无法正确显示.
我写了两个示例程序,两个都没有正常工作.
计划1
unit Unit1;
interface
uses
Windows, Classes, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdRawBase,IdRawClient, IdIcmpClient, Messages, SysUtils, Variants, Graphics, Controls, Forms,
Dialogs,StdCtrls,ExtCtrls;
type
TPSThread=class(TThread)
protected
procedure execute; override;
end;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
Procedure WndProc(var Message: TMessage); Override;
{ Public declarations }
end;
var
Form1: TForm1;
PortG:Integer;
HostG:string;
FormG:TForm;
WM_Msg_PS:DWORD;
implementation
{$R *.dfm}
procedure TPSThread.execute;
var
IcmpClient:TIdIcmpClient; …Run Code Online (Sandbox Code Playgroud) 考虑以下代码:
TForm3 = class(TForm)
public
class procedure GetAConn(var res:String); overload;
class procedure GetAConn(var res:Integer);overload;
{ Public declarations }
end;
class procedure TForm3.GetAConn(var res: String);
begin
showmessage(res);
end;
class procedure TForm3.GetAConn(var res: Integer);
begin
showmessage(IntToStr(res))
end;
Run Code Online (Sandbox Code Playgroud)
编译没有任何问题.
现在,如果我这样做:
procedure TForm3.FormCreate(Sender: TObject);
begin
TForm3.GetAConn('aaa');
TForm3.GetAConn(10);
end;
Run Code Online (Sandbox Code Playgroud)
我得到[DCC错误] Unit3.pas(64):E2250没有可以使用这些参数调用的'GetAConn'的重载版本.
在Delphi XE中我没有发现有关此限制的内容.
LE:正在以这种方式工作:
class procedure TForm3.GetAConn(var res: String);
begin
res := res + 'modif';
end;
class procedure TForm3.GetAConn(var res: Integer);
begin
res := res + 100;
end;
procedure TForm3.FormCreate(Sender: TObject);
var s:String;
i:Integer;
begin …Run Code Online (Sandbox Code Playgroud) 我正在使用delphi xe
我想在运行时更改树视图节点的文本,该节点已在屏幕截图中圈出.

我正在使用下面的代码来更改它
TreeView1.Items[2].Item[6].Text:='Some Text';
Run Code Online (Sandbox Code Playgroud)
但是得到下面的错误
列表索引超出范围(6)
但是,如果我更改第一项的任何子项的文本,例如相同的代码
TreeView1.Items[0].Item[1].Text:='Some Text';
Run Code Online (Sandbox Code Playgroud)
我试图返回一个扩展的VCL形式的Delphi数组.代码如下: -
function Calc_Er(
n: Integer;
RadioGroup3.ItemIndex : Boolean;
K1, K2 : Extended;
factor1, factor2, p, hh, ten, r : Array of Real;
Pa: extended ) : Array of Extended;
begin
if RadioGroup3.ItemIndex = 0 then
begin
if hh[n] < factor1[n] then
begin
Er[n] := K2 * (K1 + p[n]);
end
else if (hh[n] < factor2[n]) and (hh[n] > factor1[n]) then
begin
Er_stack := K2 * (K1 + p[n]);
Er[n] := (h / 100 + hh[n]) / ((h / 100 …Run Code Online (Sandbox Code Playgroud) 我想创建一个启用或禁用按钮的过程,我可以用一个程序吗?例如像这样:
Procedure MainForm.buttonsEnabled(boolean);
BEGIN
if result=true then
begin
button1.enabled:=True;
button2.enabled:=True;
button3.enabled:=True;
end else
begin
button1.enabled:=false;
button2.enabled:=false;
button3.enabled:=false;
end;
END;
Run Code Online (Sandbox Code Playgroud)
当我调用程序禁用或启用按钮时,我可以称之为
buttonsEnabled:=True;// to enable button
buttonsEnabled:=False;// to disable button
Run Code Online (Sandbox Code Playgroud)
我能这样做吗?我找不到以简单的方式做到这一点的方法
我曾经遇到过一个使用了几个网站JSON的请求和响应
我遇到两种类型:
1 application/x-www-form-urlencoded请求和返回响应application/json内容类型
2- application/json内容类型请求和响应
在type 1我试图用改变的响应内容类型
mIdHttp.Response.ContentType := 'application/json';
,但使用HTTP分析器,我可以看到它没有改变,它text/html
现在仍然不知道问题是否与我无法改变内容类型的事实,但我不知道如何处理json!
关于json以下问题:
1-我必须在发布时对json数据进行编码吗?怎么样 ?
2-我如何解析json响应代码?怎么弄明白?它需要某种编码或特殊转换吗?
3- json的哪种idhttp设置随每个站点的变化而需要配置?
我理解我的问题听起来有点笼统,但所有其他问题都非常具体,并且在处理'application/json'内容类型时没有解释基本知识.
编辑1:
感谢Remy Lebeau 回答我能够成功合作,type 1
但我仍然无法发送JSON请求,有人可以分享一个工作示例,这是发布信息的网站之一,请使用此示例:
一个重要的注意事项: 这个特定网站的帖子和请求内容完全相同!因为在现场,我指定它令我感到困惑start date和end date然后点击一个folder like icon,这post被发送(一个你可以在上面看到),而result应该是links(它是),而不是只出现在request content它们也会出现在post!(我也试图获取链接,但在post链接,我想要的东西,也被发送,我怎么能发布我没有的东西!!?)