code_26363.txt
код элемента
include("WinControl-proc")
func init
// add widget
sys.add_widget('Label')
// initialize properties
sys.set_undef_field('Text', this.props("Caption"))
// initialize events
sys.add_event('onClick', 'Click', this.codename + '.Text')
// initialize common events and properties
include("WinControl-init")
end
func doText(text)
blk.println(this.codename + '.Text = ', d("Text"), ';')
end
func Caption
return(this.codename + '.Text')
end
func init
// add widget
sys.add_widget('Label')
// initialize properties
sys.set_undef_field('Text', this.props("Caption"))
// initialize events
sys.add_event('onClick', 'Click', this.codename + '.Text')
// initialize common events and properties
include("WinControl-init")
end
func doText(text)
blk.println(this.codename + '.Text = ', d("Text"), ';')
end
func Caption
return(this.codename + '.Text')
end
Отладка
Command line: csc.exe "/out:C:\Documents and Settings\User\Projects\CNET_benchmark\label_text.exe" /target:winexe "/win32res:C:\Program Files\HiAsm\Elements\cnet\code\allres.res" "C:\Program Files\HiAsm\Elements\cnet\code\label_text.cs"
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
c:\Program Files\HiAsm\Elements\CNET\code\label_text.cs(22,3): error CS0103: The name 'res2' does not exist in the current context
c:\Program Files\HiAsm\Elements\CNET\code\label_text.cs(23,18): error CS0103: The name 'res2' does not exist in the current context
Сборка завершена.
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
c:\Program Files\HiAsm\Elements\CNET\code\label_text.cs(22,3): error CS0103: The name 'res2' does not exist in the current context
c:\Program Files\HiAsm\Elements\CNET\code\label_text.cs(23,18): error CS0103: The name 'res2' does not exist in the current context
Сборка завершена.
Исходник на До-диез
using System;
using System.Windows.Forms;
using System.Drawing;
public class MyForm : Form {
------------ Дoбавленo в 09.37:
Форум испортил сообщение и не даёт отредактировать, т.ч. досылаю
------------ Дoбавленo в 09.53:
using System.Windows.Forms;
using System.Drawing;
public class MyForm : Form {
------------ Дoбавленo в 09.37:
Форум испортил сообщение и не даёт отредактировать, т.ч. досылаю
Ария в До-диез
using System;
using System.Windows.Forms;
using System.Drawing;
public class MyForm : Form {
private Form EntryPoint1;
private long counter2;
private Label Label3;
public MyForm() {
EntryPoint1 = this;
Text = "Form";
Left = 0;
Top = 0;
Width = 400;
Height = 300;
// init --------------------------------------------
Label3 = new Label();
addWidget(Label3, 90, 80, 50, 15);
// main body ---------------------------------------
counter2 = DateTime.Now.Ticks;
res2 = (int)(DateTime.Now.Ticks - counter2)/10000;
Label3.Text = (res2).ToString();
}
private void addWidget(Control ctl, int x, int y, int w, int h) {
ctl.Location = new System.Drawing.Point(x, y);
ctl.Size = new System.Drawing.Size(w, h);
this.Controls.Add(ctl);
}
public static void Main() {
Application.Run(new MyForm());
}
}
using System.Windows.Forms;
using System.Drawing;
public class MyForm : Form {
private Form EntryPoint1;
private long counter2;
private Label Label3;
public MyForm() {
EntryPoint1 = this;
Text = "Form";
Left = 0;
Top = 0;
Width = 400;
Height = 300;
// init --------------------------------------------
Label3 = new Label();
addWidget(Label3, 90, 80, 50, 15);
// main body ---------------------------------------
counter2 = DateTime.Now.Ticks;
res2 = (int)(DateTime.Now.Ticks - counter2)/10000;
Label3.Text = (res2).ToString();
}
private void addWidget(Control ctl, int x, int y, int w, int h) {
ctl.Location = new System.Drawing.Point(x, y);
ctl.Size = new System.Drawing.Size(w, h);
this.Controls.Add(ctl);
}
public static void Main() {
Application.Run(new MyForm());
}
}
Add(EntryPoint,2953706,21,105)
{
link(onCreate,2297381:doStart,[])
}
Add(Label,5116148,119,112)
{
Left=75
Top=110
Point(onClick)
}
Add(TimeCounter,2297381,77,105)
{
link(onStart,2297381:doStop,[(168,111)(168,156)(65,156)(65,118)])
link(onStop,5116148:doText,[])
}
[offtop]Перевыложил схему и тут же появилось пропавшее ранее вложение - схема, да не одно, а с бонусом [/offtop]