Hallo Coder,
ich bin immer noch neu in C# und kämpfe mit Basics ;-(
Also: Ich habe da ein Klasse gebaut, die Daten verarbeitet. Als Resultat
speichert Sie ein Bitmap.
Nun möchte ich das Bitmap in einem Winform aufrufen um dem Nutzer
zu ermöglichen, Das Bild zu Drucken, es per Mail zu verschicken etc.
Nur leider raffe ich nicht, wie ich den Filename an das Winform übergebe, damit es angezeigt wird ;-(
Bitte kann mir jemand helfen
Hier meine Code-idee:
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Collections;
using System.ComponentModel;
using System.Data;
namespace csExample
{
[Guid("d9472cd1-bf89-42d5-a6c5-3b58156562f4"), ClassInterface(ClassInterfaceType.None)]
public class NotifyClass : ServiceApplication
{
object ServiceApplication.Notify(string service, object data)
{
object ret = null;
string filename="";
try
{
// Initialize the service
...hier passiert irgendwas....
filename="C:\\bitmap.bmp";
WinForm wf = new WinForm();
wf.show(filename);
Wenn ich das mache, bekomme ich immer die Fehlermeldung:
csExample.WinForm(string) hat die falsche Signatur, um ein Einstiegspunkt zu sein
Keine Überladung für die Mehtode 'Winform' erforder () Argumente
csExample.WinForm enthält keine Definition für show
} catch
{
}
retrurn ret;
}
}// Ende Puplic Class
public class WinForm : System.Windows.Forms.Form
{
/// <summary>
/// Erforderliche Designervariable
/// </summary>
private String image;
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.PictureBox pictureBox1;
public WinForm(string arg)
{
image = arg;
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(24, 32);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(264, 320);
this.pictureBox1.TabIndex = 4;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(448, 405);
this.Controls.Add(this.pictureBox1);
this.Name = "WinForm";
this.Text = "services";
this.Load += new System.EventHandler(this.WinForm_Load);
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main(string arg)
{
Application.Run(new WinForm(arg));
}
private Bitmap MyImage ;
private void WinForm_Load(object sender, System.EventArgs e)
{
this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
MyImage = new Bitmap(image);
this.pictureBox1.Image = (Image) MyImage ;
}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
}
}
} // Ende Namespace Klammer
:-( :-( WinForm wf = new WinForm(); wf.show(filename);
ich bin immer noch neu in C# und kämpfe mit Basics ;-(
Also: Ich habe da ein Klasse gebaut, die Daten verarbeitet. Als Resultat
speichert Sie ein Bitmap.
Nun möchte ich das Bitmap in einem Winform aufrufen um dem Nutzer
zu ermöglichen, Das Bild zu Drucken, es per Mail zu verschicken etc.
Nur leider raffe ich nicht, wie ich den Filename an das Winform übergebe, damit es angezeigt wird ;-(
Bitte kann mir jemand helfen
Hier meine Code-idee:
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Collections;
using System.ComponentModel;
using System.Data;
namespace csExample
{
[Guid("d9472cd1-bf89-42d5-a6c5-3b58156562f4"), ClassInterface(ClassInterfaceType.None)]
public class NotifyClass : ServiceApplication
{
object ServiceApplication.Notify(string service, object data)
{
object ret = null;
string filename="";
try
{
// Initialize the service
...hier passiert irgendwas....
filename="C:\\bitmap.bmp";
WinForm wf = new WinForm();
wf.show(filename);
Wenn ich das mache, bekomme ich immer die Fehlermeldung:
csExample.WinForm(string) hat die falsche Signatur, um ein Einstiegspunkt zu sein
Keine Überladung für die Mehtode 'Winform' erforder () Argumente
csExample.WinForm enthält keine Definition für show
} catch
{
}
retrurn ret;
}
}// Ende Puplic Class
public class WinForm : System.Windows.Forms.Form
{
/// <summary>
/// Erforderliche Designervariable
/// </summary>
private String image;
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.PictureBox pictureBox1;
public WinForm(string arg)
{
image = arg;
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(24, 32);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(264, 320);
this.pictureBox1.TabIndex = 4;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(448, 405);
this.Controls.Add(this.pictureBox1);
this.Name = "WinForm";
this.Text = "services";
this.Load += new System.EventHandler(this.WinForm_Load);
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main(string arg)
{
Application.Run(new WinForm(arg));
}
private Bitmap MyImage ;
private void WinForm_Load(object sender, System.EventArgs e)
{
this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
MyImage = new Bitmap(image);
this.pictureBox1.Image = (Image) MyImage ;
}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
}
}
} // Ende Namespace Klammer

