Просмотр исходного кода

2003-03-10 Joel Basson <[email protected]>

*	PictureBox.cs

svn path=/trunk/mcs/; revision=12407
Joel Basson 23 лет назад
Родитель
Сommit
ccfeba1171

+ 42 - 0
mcs/class/System.Windows.Forms/Gtk/GroupBox.cs

@@ -0,0 +1,42 @@
+//		
+//			System.Windows.Forms.GroupBox
+//
+//			Author: 
+//						Joel Basson		([email protected])
+//
+//
+
+using System.Drawing;
+using System.Drawing.Printing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+	/// <summary>
+	/// 	Represents a Windows GroupBox.
+	///
+	/// </summary>
+
+	public class GroupBox : Form {
+
+	public GroupBox () : base ()
+	{
+	}
+
+	internal override Gtk.Widget CreateWidget () {
+		Gtk.Frame gbox1 = new Gtk.Frame(null);
+		return gbox1;	
+	}
+	
+	public override string Text {
+		get {
+					return ((Gtk.Frame)Widget).Label;
+		}
+		set {
+					((Gtk.Frame)Widget).Label = value;
+		}	
+	
+	}
+	
+	}
+}

+ 68 - 0
mcs/class/System.Windows.Forms/Gtk/PictureBox.cs

@@ -0,0 +1,68 @@
+//		
+//			System.Windows.Forms.PictureBox
+//
+//			Author: 
+//						Joel Basson		([email protected])
+//
+//
+
+using System.Drawing;
+using System.Drawing.Printing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+	
+	/// <summary>
+	/// Represents a Windows PictureBox control.
+	///
+	/// </summary>
+
+	public class PictureBox: Control{
+		bool stretch;
+		int height, width, dwidth, dheight;
+		Gdk.Pixbuf pic1, pic2;
+		string filevalue;
+	public PictureBox () : base ()
+	{
+	}
+
+	internal override Gtk.Widget CreateWidget () {
+		Gtk.Image ibox = new Gtk.Image();
+		//cbox.Add (label.Widget);
+		return ibox;	
+	}
+	
+	public string File {	
+		set {
+				filevalue = value;
+				Gdk.Pixbuf pic1 = new Gdk.Pixbuf(filevalue);
+				((Gtk.Image)Widget).Pixbuf = pic1;	
+				
+		}
+	}
+	
+	public bool Stretch {
+		
+		get {
+					return stretch;
+		}
+		set {
+				if (value){ 
+						Gdk.Pixbuf pic1 = new Gdk.Pixbuf(filevalue);
+						height = pic1.Height;
+						width = pic1.Width;	
+						dheight = ((Gtk.Image)Widget).HeightRequest;
+						dwidth = ((Gtk.Image)Widget).WidthRequest;
+						((Gtk.Image)Widget).Pixbuf = pic1.ScaleSimple(dwidth, dheight, Gdk.InterpType.Bilinear);
+						stretch = value;
+				}
+				else{
+						Gdk.Pixbuf pic1 = new Gdk.Pixbuf(filevalue);
+						((Gtk.Image)Widget).Pixbuf = pic1;
+						stretch = value;
+				} 
+		}
+	}
+
+	}
+}

+ 5 - 1
mcs/class/System.Windows.Forms/Gtk/changelog

@@ -1,4 +1,8 @@
-2003-3-08  Joel Basson  <[email protected]>
+2003-03-10  Joel Basson  <[email protected]>
+
+* PictureBox.cs
+
+2003-03-08  Joel Basson  <[email protected]>
 
 * Frame.cs should have been GroupBox.cs
 

+ 1 - 0
mcs/class/System.Windows.Forms/Gtk/makefile

@@ -23,6 +23,7 @@ SOURCES = \
 	RadioButton.cs	\
 	GroupBox.cs	\
 	ProgressBar.cs	\
+	PictureBox.cs	\
 	ScrollableControl.cs
 
 all: demo.exe