Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorAlexandre Pigolkine <pigolkine@mono-cvs.ximian.com>2003-02-22 12:20:52 +0300
committerAlexandre Pigolkine <pigolkine@mono-cvs.ximian.com>2003-02-22 12:20:52 +0300
commite1eaf58f4b53104197badc419206d324d39df3a1 (patch)
treed0911894f4e69955cc7402a16d52b4d7be708b33 /mcs
parent842cca7222017c7171cbf5b9c9852df67e2afcd5 (diff)
few test files deletes, new will be added
svn path=/trunk/mcs/; revision=11829
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Test/ErrorHandler.cs123
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.Test/OwnerDrawListBox.cs170
2 files changed, 0 insertions, 293 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/ErrorHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/ErrorHandler.cs
deleted file mode 100644
index 8fbc00beb4b..00000000000
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/ErrorHandler.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-//------------------------------------------------------------------------------
-/// <copyright from='1997' to='2001' company='Microsoft Corporation'>
-/// Copyright (c) Microsoft Corporation. All Rights Reserved.
-///
-/// This source code is intended only as a supplement to Microsoft
-/// Development Tools and/or on-line documentation. See these other
-/// materials for detailed information regarding Microsoft code samples.
-///
-/// </copyright>
-//------------------------------------------------------------------------------
-namespace Microsoft.Samples.WinForms.Cs.ErrorHandler {
- using System;
- using System.ComponentModel;
- using System.Drawing;
- using System.Windows.Forms;
- using System.Threading;
-
- //The Error Handler class
- //We need a class because event handling methods can't be static
- internal class CustomExceptionHandler {
-
- //Handle the exception event
- public void OnThreadException(object sender, ThreadExceptionEventArgs t) {
-
- DialogResult result = DialogResult.Cancel;
- try {
- result = this.ShowThreadExceptionDialog(t.Exception);
- }
- catch {
- try {
- MessageBox.Show("Fatal Error", "Fatal Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
- }
- finally {
- Application.Exit();
- }
- }
-
- if (result == DialogResult.Abort)
- Application.Exit();
-
- }
-
- private DialogResult ShowThreadExceptionDialog(Exception e) {
- string errorMsg = "An error occurred please contact the adminstrator with the following information:\n\n";
- errorMsg = errorMsg + e.Message + "\n\nStack Trace:\n" + e.StackTrace;
- return MessageBox.Show(errorMsg, "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
- }
- }
-
- public class ErrorHandler : System.Windows.Forms.Form {
- private System.ComponentModel.Container components;
- private System.Windows.Forms.Button button1;
-
- public ErrorHandler() {
-
- // Required by the Win Forms Designer
- InitializeComponent();
-
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose(bool disposing)
- {
- if (disposing) {
- if (components != null) {
- components.Dispose();
- }
- }
- base.Dispose(disposing);
- }
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.button1 = new System.Windows.Forms.Button();
-
- this.button1.Size = new System.Drawing.Size(120, 40);
- this.button1.TabIndex = 1;
- this.button1.Font = new System.Drawing.Font("TAHOMA", 8f, System.Drawing.FontStyle.Bold);
- this.button1.Location = new System.Drawing.Point(256, 64);
- this.button1.Text = "Click Me!";
-
- this.button1.Click += new System.EventHandler(button1_Click);
-
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(392, 117);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {button1});
- this.Text = "Exception Handling Sample";
- }
-
- private void button1_Click(object sender, System.EventArgs e) {
- throw new ArgumentException("The parameter was invalid");
- }
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- public static void Main(string[] args) {
- CustomExceptionHandler eh = new CustomExceptionHandler();
- Application.ThreadException += new ThreadExceptionEventHandler(eh.OnThreadException);
- Application.Run(new ErrorHandler());
- }
-
-
- }
-}
-
-
-
-
-
-
-
-
-
-
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/OwnerDrawListBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/OwnerDrawListBox.cs
deleted file mode 100644
index 949c916da63..00000000000
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms.Test/OwnerDrawListBox.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-//------------------------------------------------------------------------------
-/// <copyright from='1997' to='2001' company='Microsoft Corporation'>
-/// Copyright (c) Microsoft Corporation. All Rights Reserved.
-///
-/// This source code is intended only as a supplement to Microsoft
-/// Development Tools and/or on-line documentation. See these other
-/// materials for detailed information regarding Microsoft code samples.
-///
-/// </copyright>
-//------------------------------------------------------------------------------
-namespace Microsoft.Samples.WinForms.Cs.OwnerDrawListBox {
- using System;
- using System.ComponentModel;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Drawing.Text;
- using System.Reflection;
- using System.Windows.Forms;
-
- // <doc>
- // <desc>
- // This sample control demonstrates various properties and
- // methods for the ListBox control.
- // </desc>
- // </doc>
- //
- public class OwnerDrawListBox : System.Windows.Forms.Form {
-
- //Used to paint the list box
- private Brush[] listBoxBrushes ;
- private int[] listBoxHeights = new int[] {50, 25, 33, 15} ;
- private FontFamily sansSerifFontFamily;
-
- // <doc>
- // <desc>
- // Public Constructor
- // </desc>
- // </doc>
- public OwnerDrawListBox() : base() {
- sansSerifFontFamily = new FontFamily (GenericFontFamilies.SansSerif);
-
- // This call is required for support of the Windows Forms Form Designer.
- InitializeComponent();
-
-
- //Set up the brushes we are going to use
-
- //Load the image to be used for the background from the exe's resource fork
-/*
- Image backgroundImage = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("colorbars.jpg"));
- //Now create the brush we are going to use to paint the background
- Brush backgroundBrush = new TextureBrush(backgroundImage);
-*/
- Brush backgroundBrush = new SolidBrush(Color.Blue);
- Rectangle r = new Rectangle(0, 0, listBox1.Width, 100);
- LinearGradientBrush lb = new LinearGradientBrush(r, Color.Red, Color.Yellow,LinearGradientMode.Horizontal);
-
-
- listBoxBrushes = new Brush[]
- {
- backgroundBrush,
- Brushes.LemonChiffon,
- lb,
- Brushes.PeachPuff
- };
-
- }
-
- // <doc>
- // <desc>
- // OwnerDrawListBox overrides dispose so it can clean up the
- // component list.
- // </desc>
- // </doc>
- //
- protected override void Dispose(bool disposing)
- {
- if (disposing) {
- if (components != null) {
- components.Dispose();
- }
- }
- base.Dispose(disposing);
- }
-
- private void listBox1_DrawItem(object sender, DrawItemEventArgs e) {
-
- // The following method should generally be called before drawing.
- // It is actually superfluous here, since the subsequent drawing
- // will completely cover the area of interest.
- e.DrawBackground();
-
- //The system provides the context
- //into which the owner custom-draws the required graphics.
- //The context into which to draw is e.graphics.
- //The index of the item to be painted is e.Index.
- //The painting should be done into the area described by e.Bounds.
- Brush brush = listBoxBrushes[e.Index];
- e.Graphics.FillRectangle(brush, e.Bounds);
- e.Graphics.DrawRectangle(SystemPens.WindowText, e.Bounds);
-
- bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? true : false;
-
- string displayText = "ITEM #" + e.Index;
- displayText = displayText + (selected ? " SELECTED" : "");
-
- e.Graphics.DrawString(displayText, this.Font, Brushes.Black, e.Bounds);
-
- e.DrawFocusRectangle();
- }
-
- //Return the height of the item to be drawn
- private void listBox1_MeasureItem(object sender, MeasureItemEventArgs e) {
- //Work out what the text will be
- string displayText = "ITEM #" + e.Index;
-
- //Get width & height of string
- SizeF stringSize=e.Graphics.MeasureString(displayText, this.Font);
-
- //Account for top margin
- stringSize.Height += 6;
-
- //Now set height to taller of default and text height
- if (listBoxHeights[e.Index] > stringSize.Height)
- e.ItemHeight = listBoxHeights[e.Index];
- else
- e.ItemHeight = (int)stringSize.Height;
- }
-
- // NOTE: The following code is required by the Windows Forms Form Designer
- // It can be modified using the Windows Forms Form Designer.
- // Do not modify it using the code editor.
- private System.ComponentModel.IContainer components;
- private System.Windows.Forms.ListBox listBox1;
-
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.listBox1 = new System.Windows.Forms.ListBox();
- this.listBox1.ColumnWidth = 144;
- this.listBox1.ForeColor = (System.Drawing.Color)SystemColors.WindowText;
- this.listBox1.IntegralHeight = false;
- this.listBox1.Items.AddRange(new object[4] {"First", "Second", "Third", "Fourth"});
- this.listBox1.Location = new System.Drawing.Point(8, 24);
- this.listBox1.Size = new System.Drawing.Size(232, 200);
- this.listBox1.TabIndex = 0;
- this.listBox1.UseTabStops = true;
- this.listBox1.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(listBox1_MeasureItem);
- this.listBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(listBox1_DrawItem);
- this.listBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
- this.AutoScale = false;
- this.ClientSize = new System.Drawing.Size(248, 248);
- this.Font = new System.Drawing.Font(sansSerifFontFamily, 12);
- this.Text = "ListBox";
- this.Controls.AddRange(new System.Windows.Forms.Control[] {this.listBox1});
-
- }
-
- // The main entry point for the application.
- [STAThread]
- public static void Main(string[] args) {
- Application.Run(new OwnerDrawListBox());
- }
- }
-
-}
-
-
-
-