如何创建(当我想要显示它)并在主TForm上销毁(当我想隐藏它时)帧?帧'align = alClient.
我试过这个:
表格:
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, uFrame1, uFrame2;
type
TFormMain = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
f1: TFrame1;
f2: TFrame2;
end;
var
FormMain: TFormMain;
implementation
{$R *.dfm}
procedure TFormMain.FormCreate(Sender: TObject);
begin
f1 := TFrame1.Create(Self);
f1.Parent := Self;
end;
end.
Run Code Online (Sandbox Code Playgroud)
第一帧:
unit uFrame1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TFrame1 = class(TFrame) …Run Code Online (Sandbox Code Playgroud) 我正在使用Awesomium 1.7.0.5来加载页面,填充一些文本框并单击按钮.我正在尝试使用此主题中的示例来填充文本框:http://answers.awesomium.com/questions/857/webcontrol-type-in-webbrowser.html
这是我的代码(我正在使用WPF控件):
private void WbAwsOnDocumentReady(object sender, UrlEventArgs urlEventArgs)
{
if (wbAws == null || !wbAws.IsLive)
return;
//Thread.Sleep(555);
dynamic document = (JSObject)wbAws.ExecuteJavascriptWithResult("document");
if (document == null)
return;
using (document)
{
dynamic textbox = document.getElementById("email");
if (textbox == null)
return;
using (textbox)
{
textbox.value = "gaaffa";
}
}
}
Run Code Online (Sandbox Code Playgroud)
它可以工作,但只能使用Thread.Sleep 0.1-0.5秒.否则,文档为空(非空)和/或文本框为空.我该怎么办?为什么在DocumentReadyEvent中没有准备好?
我在Appdir 里面有Releasedir
$ cd Release
$ tree
.
`-- App
|-- App.exe
..........
Run Code Online (Sandbox Code Playgroud)
我试图App-1.0.zip在Release包含App所有内容的目录中创建。那是在解包之后App-1.0.zip我会得到这个App目录。
我试过了,shutil.make_archive但是当我这样做时
import shutil
shutil.make_archive('App-1.0', 'zip', '.')
Run Code Online (Sandbox Code Playgroud)
从Release目录,我得到48字节App-1.0.zip内App-1.0.zip除了App目录。也就是说,它将这个未完成的档案添加到自己身上。
除了在临时目录中创建存档并移动之外,有没有办法避免这种情况?
我试图设置base_dir和使用App作为root_dir
shutil.make_archive('App-1.0', 'zip', 'App', 'App')
Run Code Online (Sandbox Code Playgroud)
但是我App在设置时遇到了未找到的错误base_dir。
Traceback (most recent call last):
File ".......archive.py", line 4, in <module>
shutil.make_archive('App-1.0', 'zip', 'App', 'App')
File "C:\Users\Alex\.virtualenvs\....-nAKWzegL\lib\shutil.py", line 800, …Run Code Online (Sandbox Code Playgroud) 当我向项目添加Access DB文件并将其设置为Copy for newer时,我发现了这个问题:

我认为只有当输出目录中的文件比项目目录中的文件旧时才会将其复制到输出目录.
事实上,即使输出目录中的文件较新,它也会被复制:例如,当我编辑并通过我的程序保存它时.
我还使用另一种文件(.txt)在另一个项目中测试了它.
MSDN说
如果要复制文件,只有在文件比输出目录中的同名现有文件更新时,才选择"如果更新则复制".
这是一个错误还是我做错了什么?
我有一个二进制文件(2.5 MB),我想找到这个字节序列的位置:CD 09 D9 F5.然后我想在这个位置后写一些数据,并用零覆盖旧数据(4 KB).
这是我现在的方式,但它有点慢.
ProcessFile(dataToWrite: string);
var
fileContent: string;
f: file of char;
c: char;
n, i, startIndex, endIndex: integer;
begin
AssignFile(f, 'file.bin');
reset(f);
n := FileSize(f);
while n > 0 do
begin
Read(f, c);
fileContent := fileContent + c;
dec(n);
end;
CloseFile(f);
startindex := Pos(Char($CD)+Char($09)+Char($D9)+Char($F5), fileContent) + 4;
endIndex := startIndex + 4088;
Seek(f, startIndex);
for i := 1 to length(dataToWrite) do
Write(f, dataToWrite[i]);
c := #0;
while (i < endIndex) do
begin
Write(f, c); inc(i); …Run Code Online (Sandbox Code Playgroud) 我有RowLayout一些物品
RowLayout {
anchors.fill: parent
anchors.leftMargin: 3
Image {
id: icon
source: imgSource
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
}
Text {
id: caption
height: parent.height
fontSizeMode: Text.Fit
font.pointSize: textSize
verticalAlignment: Text.AlignVCenter
text: captionText
color: "white"
}
}
Run Code Online (Sandbox Code Playgroud)
我想ColorOverlay在Image这个布局中应用:
ColorOverlay {
id: overlay
anchors.fill: icon
source: icon
color: "#ff0000ff"
}
Run Code Online (Sandbox Code Playgroud)
但如果我把它放在ColorOverlay布局之外,那么我就不能使用anchors.fill: icon. 如果我把它变成一个孩子
Image {
id: icon
source: imgSource
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
ColorOverlay {
id: overlay
anchors.fill: icon
source: …Run Code Online (Sandbox Code Playgroud) 我正在尝试序列化和反序列化此ObservableCollection:
public class DataCollection : ObservableCollection<Data>
{
}
public class Data : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private bool? _enabled;
public string Name { get; set; }
public bool? Enabled
{
get { return _enabled; }
set { _enabled = value; NotifyPropertyChanged("Enabled"); }
}
public Data(string name, bool? enabled)
{
this.ScriptName = name;
this.Enabled = enabled;
}
private void NotifyPropertyChanged(string property)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
Run Code Online (Sandbox Code Playgroud)
使用此类(如将对象的Observable collectin保存到XML文件的最简单方法是什么?示例):
class UserPreferences …Run Code Online (Sandbox Code Playgroud) 导入外墙命名空间的正确方法是什么(例如Hash::make)?
我需要使用导入use Illuminate\Support\Facades\Hash吗?
我看到有些人使用它们\Hash::make(来自命名空间文件,例如默认创建的控制器)或Hash::make(来自非命名空间的文件,例如路由).
此外IDE辅助生成的根命名空间外墙:
namespace {
exit("This file should not be included, only analyzed by your IDE");
class Hash extends \Illuminate\Support\Facades\Hash{
/** ... */
public static function make($value, $options = array()){
return \Illuminate\Hashing\BcryptHasher::make($value, $options);
}
Run Code Online (Sandbox Code Playgroud)
但我不明白为什么它的工作原理如果这个类在Illuminate\Support\Facades\命名空间中,而不是在根命名空间中.
我正在尝试为简单的编程语言创建 ANTLR 语法。
它有类似 C 的 if 语句:
program
: statement* EOF
;
statement
: block # blockStatement
| SEMI # emptyStatement
| assignment # assignmentStatement
| declaration # variableDeclarationStatement
| 'if' parExpression ifBody=statement ('else' elseBody=statement)? # ifStatement
..........
;
block
: '{' statement* '}'
;
expression
: literal # literalExpression
| Identifier # variableReference
..........
;
parExpression : '(' expression ')';
assignment : Identifier assignmentOp expression SEMI;
SEMI : ';';
Identifier : (LETTER | '_') (LETTER | DIGIT | …Run Code Online (Sandbox Code Playgroud) 我需要创建一个支持调整大小的无框架 Qt Windows 应用程序。
如果我使用
setWindowFlags(Qt::FramelessWindowHint);
Run Code Online (Sandbox Code Playgroud)
然后我只能从右下角调整大小(就像大小手柄一样,我猜 QMainWindow 以某种方式包含它?)。
有没有什么简单的方法可以让它像普通窗口一样从四面八方调整大小?也许是特定于平台的(Windows)?
c# ×3
.net ×2
delphi ×2
qt ×2
antlr ×1
antlr4 ×1
archive ×1
awesomium ×1
binaryfiles ×1
c++ ×1
delphi-7 ×1
frame ×1
freepascal ×1
grammar ×1
laravel ×1
laravel-5 ×1
laravel-5.3 ×1
lazarus ×1
namespaces ×1
php ×1
python ×1
python-3.x ×1
qml ×1
qt-quick ×1
qt5 ×1
qtquick2 ×1
shutil ×1
winapi ×1
wpf ×1
xml ×1