add a test for a propertygrid displaying an array, and make the Makefile a bit more sane/extensible

svn path=/trunk/winforms/; revision=67545
This commit is contained in:
Chris Toshok 2006-11-08 17:15:08 +00:00
Родитель d7a838b232
Коммит 38d49b9176
2 изменённых файлов: 80 добавлений и 6 удалений

Просмотреть файл

@ -1,10 +1,21 @@
all: mono
EXE= swf-propertygrid.exe \
swf-propertygrid-array.exe
mono: swf-propertygrid.cs
mcs swf-propertygrid.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
MDB=
dotnet: swf-propertygrid.cs
csc swf-propertygrid.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
CSC=mcs
all: $(EXE)
mono:
make all CSC=mcs
dotnet:
make all CSC=csc
clean:
rm swf-propertygrid.exe -r -f
rm -f $(EXE) $(EXE:%.exe=%.exe.mdb)
%.exe: %.cs
$(CSC) -out:$@ -debug $< /r:System.Windows.Forms.dll /r:System.Drawing.dll

Просмотреть файл

@ -0,0 +1,63 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace MWFTestApplication {
class MainWindow : System.Windows.Forms.Form {
static MainWindow main_window;
static Control active;
PropertyGrid propertygrid;
public MainWindow() {
ClientSize = new System.Drawing.Size (520, 520);
Text = "Property Grid Array Test";
int[] testarray = new int[10];
for (int i = 0; i < testarray.Length; i ++)
testarray[i] = 10-i;
TypeConverter cvt = TypeDescriptor.GetConverter (testarray);
PropertyDescriptorCollection props = cvt.GetProperties (testarray);
PropertyDescriptorCollection tdprops = TypeDescriptor.GetProperties (testarray);
Console.WriteLine ("Converter is {0}", cvt.GetType());
Console.WriteLine ("converter properties length = {0}", props.Count);
Console.WriteLine ("typedescriptor properties length = {0}", tdprops.Count);
foreach (PropertyDescriptor prop in props) {
Console.WriteLine ("{0} : {1}", prop.Name, prop.GetType());
Console.WriteLine (" + {0} {1} {2} {3}", prop.PropertyType, prop.ComponentType, prop.CanResetValue (testarray), prop.ShouldSerializeValue (testarray));
}
Console.WriteLine (testarray[5]);
propertygrid = new PropertyGrid();
propertygrid.CommandsVisibleIfAvailable = true;
propertygrid.Dock = DockStyle.Fill;
propertygrid.TabIndex = 2;
propertygrid.Text = "Property Grid";
propertygrid.Dock = DockStyle.Fill;
this.Controls.Add(propertygrid);
propertygrid.SelectedObject = testarray;
propertygrid.PropertyValueChanged += delegate (object o, PropertyValueChangedEventArgs e) {
//Console.WriteLine (Environment.StackTrace);
};
propertygrid.SelectedGridItemChanged += delegate (object o, SelectedGridItemChangedEventArgs e) {
//Console.WriteLine (Environment.StackTrace);
};
}
public static int Main(string[] args) {
main_window = new MainWindow();
active = main_window;
Application.Run(main_window);
return 0;
}
}
}