是否可以在Delphi Chromium Embedded中禁用视图源选项?
我没有在属性/方法列表中找到任何合适的东西.
我用TPopupMenu我的计划,我想在它添加一个垂直滚动条,并能够设置其大小(如10可见项),并处理移动滑块滚动条(点击按钮后发生的事件,或滚动鼠标后轮).我想知道具有此功能的组件存在,或者我将很高兴有关创建此组件的理论.例如,我需要与Vista/7 Explorer的地址栏中的弹出菜单类似的行为(当前文件夹中包含子文件夹列表)
谢谢.
我在Delphi XE,Windows 7中工作.
在应用程序中,我想为我的用户启用不同的报告类型以供选择.为此,我有一个基本报告类和每个报告类型的子类(xml,csv,ppt等).
{Just an illustrating example}
TBaseReport = class
public
constructor Create;
procedure GenerateReport; virtual; abstract;
class function ReportType: string; virtual; abstract;
end;
T*Report = class(TBaseReport);
//Etcetera.
Run Code Online (Sandbox Code Playgroud)
我想要做的是使用Rtti检测所有报告类并列出他们的ReportType.之后,我想使用Rtti创建所选报告类的实例并调用GenerateReport.总而言之,这并不难实现.
但是有一个主要的缺点:我从不硬编码使用降序类,因此代码不会包含在可执行文件中.
有没有一种不错的方法来强制链接器/编译器包含这些类?
一个(丑陋的)解决方法是在初始化部分模拟报告的使用,但我宁愿不这样做.更好的解决方案是使基类持久化并调用'RegisterClass(T*Report);' 在初始化部分.它有效,但我没有看到任何其他需要使它们持久化,所以再次,我宁愿不这样做.另一方面,也许这是唯一的方法吗?
提前致谢.
拥有从右到左阅读模式(RTL)的树视图,如何获取被点击的节点只知道点击坐标?这是一个插入的类,它使树视图使用RTL显示,并包含一个单击处理程序,您可以在其中查看问题:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, CommCtrl;
type
TTreeView = class(ComCtrls.TTreeView)
protected
procedure CNNotify(var Msg: TWMNotify); message CN_NOTIFY;
procedure CreateParams(var Params: TCreateParams); override;
end;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TTreeView }
procedure TTreeView.CNNotify(var Msg: TWMNotify);
var
Node: TTreeNode;
Point: TPoint;
begin
inherited;
if Msg.NMHdr.code = NM_CLICK then
begin …Run Code Online (Sandbox Code Playgroud) 是否可以在WebBrowser组件上绘制或放置一些东西来绘制它?
当我在WebBrowser上添加图像时,此图像始终位于WebBrowser下.我需要这个以相同的方式在不同的地图类型上绘制区域.例如,我需要在Google地图上绘制相同区域并打开街道地图......
我必须浏览一个与indy的idhttp保持会话ID的网站.
我使用以下代码初始化我需要的组件.
procedure InitSession;
begin
Initalized := True;
try
ihttp := TIdHTTP.Create(nil); //the variables are declared globally
idCookie := TIdCookieManager.Create(nil);
ihttp.ConnectTimeout := 5000;
ihttp.AllowCookies := true;
ihttp.HandleRedirects := true;
ihttp.CookieManager := idCookie;
except
Initalized := False;
end;
end;
Run Code Online (Sandbox Code Playgroud)
问题是当我发出请求时,不发送cookie.为了发送包含会话ID的cookie,我需要做什么.谢谢
目前我通过创建它来添加对象:
type
TRecord = class
private
str: string;
num: Integer;
public
constructor Create;
end;
...
procedure TForm1.Button2Click(Sender: TObject);
var
i: Integer;
rec: TRecord;
Alist: TStringList;
begin
Alist := TStringList.create;
Alist.Clear;
for i := 0 to 9 do
begin
rec := Trecord.Create; //create instance of class
rec.str := 'rec' + IntToStr(i);
rec.num := i * 2;
Alist.AddObject(IntToStr(i), rec);
end;
end;
Run Code Online (Sandbox Code Playgroud)
这种方法是正确还是低效?或者我可以直接添加对象而不是像使用记录一样创建它吗?
type
PRec = ^TRec;
TRec = record
str: string;
num: Integer;
end;
...
var
rec: TRec;
...
for i := …Run Code Online (Sandbox Code Playgroud) 我正在使用VT.Background在VT中显示带有几列的背景图像.
但我无法找到一种方法为细胞使用不同的颜色,因为它们隐藏了背景图像.
我曾尝试使用,OnBeforeItemErase但如果我使用EraseAction := eaColor单元格上的背景位图区域也正在绘制,如果我使用eaDefault的颜色没有被应用.
知道如何做到这一点?
我有一个应用程序,在Delphi 2007中构建,TDateTimePicker在表单上有一个.此日期时间选择器具有ShowCheckbox设置为的属性True,其在日期或时间旁边显示一个复选框,每当用户选择日期时,或者通过代码更改日期或时间时,该复选框将自动选中.此复选框的状态也可由用户手动控制,其状态可由Checked属性确定.
以下代码显示如何确定OnChange事件中此复选框的状态:
procedure TForm1.FormCreate(Sender: TObject);
begin
DateTimePicker1.ShowCheckbox := True;
end;
procedure TForm1.DateTimePicker1Change(Sender: TObject);
begin
ShowMessage('Checked: ' + BoolToStr(DateTimePicker1.Checked, True));
end;
Run Code Online (Sandbox Code Playgroud)
上面的代码在Windows XP上按预期工作,但在Windows 7上,Checked无论该复选框的实际状态如何,该属性都返回True.
为什么Checked属性返回始终为True,即使取消选中复选框也是如此?有办法以某种方式修复或解决这个问题吗?
PS我的应用程序使用Windows主题
我正在尝试定义TWaveFormatExtensible类型,但是我不确定是否正确声明了Samples联合。这是头文件(Windows SDK 10.0.17763.0)中的原始声明:
typedef struct {
WAVEFORMATEX Format;
union {
WORD wValidBitsPerSample; /* bits of precision */
WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
WORD wReserved; /* If neither applies, set to zero. */
} Samples;
DWORD dwChannelMask; /* which channels are */
/* present in stream */
GUID SubFormat;
}
Run Code Online (Sandbox Code Playgroud)
这就是我尝试过的:
type
TWAVEFORMATEX = record
wFormatTag: Word;
nChannels: LongWord;
nSamplesPerSec: Word;
nAvgBytesPerSec: LongWord;
nBlockAlign: Word;
wBitsPerSample: Word;
cbSize: Word;
end;
TWaveFormatExtensible = record
Format: TWAVEFORMATEX; …Run Code Online (Sandbox Code Playgroud) delphi ×10
delphi-7 ×3
winapi ×2
browser ×1
delphi-2007 ×1
delphi-2009 ×1
delphi-xe ×1
delphi-xe2 ×1
dom ×1
drawing ×1
indy ×1
rtti ×1
tchromium ×1
view-source ×1
windows-7 ×1