[Mono-list] pb on Winforms
Pierro
enjoylife at tele2.fr
Mon Oct 10 13:12:45 EDT 2005
Hello, i've a problem with winform.
This program function very well on Windows with the Windows's CLR.
But with the Mono's CLR , there are problems on Linux and on Windows.
What's the problem ?
Later, i will use gtk# but now i don't have any time for to learn it.
does it exist a IDE for GUI in GTK# like visual .NET ?
Thank you very much for your help.
_That is the source of my program :_
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
public class ClientSDS : System.Windows.Forms.Form
{
IGsua ObjInterface;
long ticket1;
bool Clibool=true;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button Quitter;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
/// <summary>
/// Variable necessaire au concepteur.
/// </summary>
private System.ComponentModel.Container components = null;
public ClientSDS(ref IGsua objIGsua, bool Cli)
{
ObjInterface=objIGsua;
ticket1=0;
Clibool = Cli;
InitializeComponent();
}
/// <summary>
/// Nettoyage des ressources utilises.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.Quitter = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.SystemColors.Info;
this.label1.Font = new System.Drawing.Font("Microsoft Sans
Serif", 14.25F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(24, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(456, 64);
this.label1.TabIndex = 0;
this.label1.Text = "Etude \"simple\" d\'un fichier";
this.label1.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//this.label1.Click += new System.EventHandler(this.label1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(16, 128);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(400, 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft Sans
Serif", 11.25F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label2.Location = new System.Drawing.Point(8, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(432, 80);
this.label2.TabIndex = 2;
this.label2.Text = "Fichier";
//this.label2.Click += new System.EventHandler(this.label2_Click);
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans
Serif", 9.75F/*14.25F*/, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.button1.Location = new System.Drawing.Point(48, 192);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(112, 32);
this.button1.TabIndex = 3;
this.button1.Text = "Parcourir";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft Sans
Serif", 15.75F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.button2.Location = new System.Drawing.Point(256, 200);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(208, 64);
this.button2.TabIndex = 4;
this.button2.Text = "Action";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Quitter
//
this.Quitter.Font = new System.Drawing.Font("Microsoft Sans
Serif", 14.25F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Quitter.Location = new System.Drawing.Point(168, 304);
this.Quitter.Name = "Quitter";
this.Quitter.Size = new System.Drawing.Size(160, 48);
this.Quitter.TabIndex = 5;
this.Quitter.Text = "Quitter";
this.Quitter.Click += new System.EventHandler(this.Quitter_Click);
//
// ClientSDS
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(520, 382);
this.Controls.Add(this.Quitter);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.label2);
this.Name = "ClientSDS";
this.Text = "ClientSDS";
this.ResumeLayout(false);
}
class prog
{
[STAThread]
static void Main()
{
MarshalByRefObject Obj=null;
bool erreurbool=true;
HttpChannel MonCanal = new HttpChannel(0);
ChannelServices.RegisterChannel(MonCanal);
try
{
Obj = (MarshalByRefObject)
RemotingServices.Connect(
typeof(IGsua),
"http://localhost:65100/ServiceGSUA");
}
catch(System.Exception)
{
MessageBox.Show("Erreur de connection avec la sds",
"Erreur de connection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
erreurbool=false;
}
IGsua monobjet = Obj as IGsua;
ClientSDS client = new ClientSDS(ref monobjet,erreurbool);
Application.Run(client);
}
}
private void Quitter_Click(object sender, System.EventArgs e)
{
ObjInterface=null;
Application.Exit();
}
private void button1_Click(object sender, System.EventArgs e)
{
if ( openFileDialog1.ShowDialog() != DialogResult.OK )
{
return;
}
else
{
textBox1.Text = (string) openFileDialog1.FileName;
}
}
private void button2_Click(object sender, System.EventArgs e)
{
if ( textBox1.Text == String.Empty )
{
MessageBox.Show("Erreur, vous devez selectionner un
fichier", "Erreur de selection de fichier", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
textBox1.Focus();
}
else
{
if(Clibool!=false)
{
//do something
}
else
{
MessageBox.Show("Pas de connection SDS"," redemarrer SDS
et ce programme ",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
More information about the Mono-list
mailing list