关于资源文件的问题

EGES 2003-08-20 03:09:25
我是一个DELPHI程序员,现在准备学习.net,
现在要将一个C#的代码转成DELPHI语言的代码,已经转换成功,并且能够执行,
但是它是使用的是C#生成的资源文件(*.resources),不知道这个文件是怎么生成的?
...全文
165 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
EGES 2003-08-22
  • 打赏
  • 举报
回复
是指C#代码转换为Delphi.NET代码,下面是一段DELPHI.NET代码:
{$R 'MyFirst.LoginForm.resources'}
program myfirst;

uses
System,
System.Drawing,
System.Collections,
System.ComponentModel,
System.Windows.Forms,
System.Data,
System.Resources;

type
LoginForm = class(Form)
components: System.ComponentModel.IContainer;
pictureBox1: System.Windows.Forms.PictureBox;
pictureBox2: System.Windows.Forms.PictureBox;
panel1: System.Windows.Forms.Panel;
groupBox1: System.Windows.Forms.GroupBox;
lblUserID: System.Windows.Forms.Label;
lblPassword: System.Windows.Forms.Label;
tbUserID: System.Windows.Forms.TextBox;
tbPassword: System.Windows.Forms.TextBox;
btnOK: System.Windows.Forms.Button;
btnCancel: System.Windows.Forms.Button;
imageList1: System.Windows.Forms.ImageList;
procedure btnCancel_Click(sender: TObject; E: EventArgs);
private
procedure InitializeComponent;
public
constructor Create;
end;


constructor LoginForm.Create;
begin
inherited;
InitializeComponent;
end;

procedure LoginForm.InitializeComponent;
var
resources: System.Resources.ResourceManager;
begin
resources := System.Resources.ResourceManager.Create(typeof(LoginForm));
Self.components := System.ComponentModel.Container.Create;
Self.pictureBox1 := System.Windows.Forms.PictureBox.Create;
Self.pictureBox2 := System.Windows.Forms.PictureBox.Create;
Self.panel1 := System.Windows.Forms.Panel.Create;
Self.groupBox1 := System.Windows.Forms.GroupBox.Create;
Self.btnCancel := System.Windows.Forms.Button.Create;
Self.btnOK := System.Windows.Forms.Button.Create;
// Self.imageList1 := System.Windows.Forms.ImageList(Self.components);
Self.tbPassword := System.Windows.Forms.TextBox.Create;
Self.tbUserID := System.Windows.forms.TextBox.Create;
Self.lblPassword := System.Windows.forms.Label.Create;
Self.lblUserID := System.Windows.Forms.Label.Create;
Self.panel1.SuspendLayout;
Self.groupbox1.SuspendLayOut;
Self.SuspendLayout;
//
// pictureBox1
//
Self.pictureBox1.Dock := System.Windows.forms.DockStyle.Top;
self.pictureBox1.Image := System.Drawing.Image(resources.GetObject('pictureBox1.Image'));
// Self.picturebox1.Image := Image.FromFile('1.jpg');
Self.pictureBox1.Location := System.Drawing.Point.Create(0, 0);
Self.pictureBox1.Name := 'pictureBox1';
Self.pictureBox1.Size := System.Drawing.Size.Create(392, 64);
Self.pictureBox1.TabIndex := 0;
Self.pictureBox1.TabStop := False;
//
// pictureBox2
//
Self.pictureBox2.Dock := System.Windows.Forms.DockStyle.Bottom;
Self.pictureBox2.Image := System.Drawing.Image(resources.GetObject('pictureBox2.Image'));
// Self.pictureBox2.Image := Image.FromFile('3.jpg');
Self.pictureBox2.Location := System.Drawing.Point.Create(0, 245);
Self.pictureBox2.Name := 'pictureBox2';
Self.pictureBox2.Size := System.Drawing.Size.Create(392, 28);
Self.pictureBox2.TabIndex := 1;
Self.pictureBox2.TabStop := False;
//
// panel1
//
// self.panel1.BackgroundImage := Image.fromFile('2.jpg');
self.panel1.BackgroundImage := System.Drawing.Image(resources.GetObject('panel1.BackgroundImage'));
self.panel1.Controls.Add(self.groupBox1);
self.panel1.dock := System.Windows.Forms.DockStyle.Fill;
self.panel1.Location := System.Drawing.Point.Create(0, 64);
self.panel1.Name := 'panel1';
self.panel1.Size := System.Drawing.Size.Create(392, 181);
self.panel1.TabIndex := 2;
//
// groupBox1
//
self.groupBox1.BackColor := System.Drawing.Color.Transparent;
self.groupBox1.Controls.Add(self.btnCancel);
self.groupbox1.Controls.Add(self.btnOK);
self.groupBox1.Controls.Add(self.tbPassword);
self.groupBox1.Controls.Add(self.tbUserID);
self.groupBox1.Controls.Add(self.lblPassword);
self.groupBox1.Controls.Add(self.lblUserID);
self.groupBox1.FlatStyle := System.Windows.Forms.FlatStyle.Flat;
self.groupBox1.Location := System.Drawing.Point.Create(56, 16);
self.groupBox1.Name := 'groupBox1';
self.groupBox1.Size := System.Drawing.Size.Create(288, 148);
self.groupBox1.TabIndex := 0;
self.groupBox1.TabStop := False;
self.groupBox1.Text := '请输入用户名和口令';
//
// btnCancel
//
self.btnCancel.FlatStyle := System.Windows.Forms.FlatStyle.Popup;
self.btnCancel.Location := System.Drawing.Point.Create(164, 108);
self.btnCancel.Name := 'btnCancel';
self.btnCancel.TabIndex := 5;
self.btnCancel.Text := '取 消(&C)';
self.btnCancel.Add_Click(self.btnCancel_Click);
//
// btnOK
//
self.btnOK.FlatStyle := System.Windows.Forms.FlatStyle.Popup;
self.btnOK.Location := System.Drawing.Point.Create(60, 108);
self.btnOK.Name := 'btnOK';
self.btnOK.TabIndex := 4;
self.btnOK.Text := '确 定(&O)';
//
// tbPassword
//
self.tbPassword.Location := System.Drawing.Point.Create(98, 64);
self.tbPassword.Name := 'tbPassword';
self.tbPassword.PasswordChar := '*';
self.tbPassword.Size := System.Drawing.Size.Create(152, 21);
self.tbPassword.TabIndex := 3;
self.tbPassword.Text := '';
//
// tbUserID
//
self.tbUserID.Location := System.Drawing.Point.Create(98, 32);
self.tbUserID.Name := 'tbUserID';
self.tbUserID.Size := System.Drawing.Size.Create(152, 21);
self.tbUserID.TabIndex := 2;
self.tbUserID.Text := '';
//
// lblPassword
//
self.lblPassword.FlatStyle := System.Windows.Forms.FlatStyle.Flat;
self.lblPassword.Location := System.Drawing.Point.Create(30, 68);
self.lblPassword.Name := 'lblPassword';
self.lblPassword.Size := System.Drawing.Size.Create(56, 16);
self.lblPassword.TabIndex := 1;
self.lblPassword.Text := '口 令:';
//
// lblUserID
//
self.lblUserID.FlatStyle := System.Windows.forms.FlatStyle.flat;
self.lblUserID.Location := System.Drawing.Point.Create(30, 40);
self.lblUserID.Name := 'lblUserID';
self.lblUserID.Size := System.Drawing.Size.Create(56, 16);
self.lblUserID.TabIndex := 0;
self.lblUserID.Text := '用户名:';
//
// LoginForm
//
self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 14);
self.ClientSize := System.Drawing.Size.Create(392, 273);
self.ControlBox := False;
self.Controls.Add(self.panel1);
self.Controls.Add(self.pictureBox2);
self.Controls.Add(self.pictureBox1);
self.FormborderStyle := System.Windows.Forms.FormBorderStyle.FixedDialog;
self.MaximizeBox := False;
self.Minimizebox := False;
self.Name := 'LoginForm';
self.StartPosition := System.Windows.Forms.FormStartPosition.CenterScreen;
self.text := '用户登录';
self.panel1.resumeLayout(false);
self.groupbox1.ResumeLayout(false);
self.ResumeLayout(false);
end;

procedure LoginForm.btnCancel_Click(sender: TObject; E: EventArgs);
begin
if MessageBox.Show('真的要退出吗?', '杰隆网站后台管理登录',
MessageBoxButtons.YesNoCancel) <> DialogResult.Yes then
Exit;
Application.Exit;
end;

//var
// LoginForm: LoginForm;
begin
// LoginForm := LoginForm.Create;
Application.Run(LoginForm.Create);
end.
bborn 2003-08-20
  • 打赏
  • 举报
回复
c#如何转换delphi 不明白
能讲讲吗?
SCYANGYU 2003-08-20
  • 打赏
  • 举报
回复
请看以下几篇文章:

http://www.chinaspx.com/comm/dotnetbbs/Showtopic.aspx?Forum_ID=31&Id=11797

http://www.chinaspx.com/comm/dotnetbbs/Showtopic.aspx?Forum_ID=31&Id=12217

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧