14 people like it.

debugging window

The window is useful when you want to print out data to the screen.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
// opening required namespaces
open System
open System.Windows.Forms
open System.Drawing

// creating form
let f = new Form(Visible = true, Text = "TextForm",
                    TopMost = true, Size = Size(800,600))
let tb = new RichTextBox(Dock = DockStyle.Fill, Text = "",
                         Font = new Font(family = new FontFamily("Consolas"), emSize = 16.0f))
f.Controls.Add tb
f.Show()

// define show
let show text =
    tb.Text <- sprintf "%A" text

// examples
show("new text")
// or use pipeline-operator
"newest text" |> show
(1,2,3) |> show
let x = [ yield "one"
          if DateTime.Now.DayOfWeek = DayOfWeek.Monday then
            yield "two"
          yield "three" ]
x |> show
namespace System
namespace System.Windows
namespace System.Windows.Forms
namespace System.Drawing
val f : Form

Full name: Script.f
Multiple items
type Form =
  inherit ContainerControl
  new : unit -> Form
  member AcceptButton : IButtonControl with get, set
  member Activate : unit -> unit
  member ActiveMdiChild : Form
  member AddOwnedForm : ownedForm:Form -> unit
  member AllowTransparency : bool with get, set
  member AutoScale : bool with get, set
  member AutoScaleBaseSize : Size with get, set
  member AutoScroll : bool with get, set
  member AutoSize : bool with get, set
  ...
  nested type ControlCollection

Full name: System.Windows.Forms.Form

--------------------
Form() : unit
Multiple items
namespace System.Drawing.Text

--------------------
namespace System.Text
Multiple items
type Size =
  struct
    new : pt:Point -> Size + 1 overload
    member Equals : obj:obj -> bool
    member GetHashCode : unit -> int
    member Height : int with get, set
    member IsEmpty : bool
    member ToString : unit -> string
    member Width : int with get, set
    static val Empty : Size
    static member Add : sz1:Size * sz2:Size -> Size
    static member Ceiling : value:SizeF -> Size
    ...
  end

Full name: System.Drawing.Size

--------------------
Size()
Size(pt: Point) : unit
Size(width: int, height: int) : unit
val tb : RichTextBox

Full name: Script.tb
Multiple items
type RichTextBox =
  inherit TextBoxBase
  new : unit -> RichTextBox
  member AllowDrop : bool with get, set
  member AutoSize : bool with get, set
  member AutoWordSelection : bool with get, set
  member BackgroundImage : Image with get, set
  member BackgroundImageLayout : ImageLayout with get, set
  member BulletIndent : int with get, set
  member CanPaste : clipFormat:Format -> bool
  member CanRedo : bool
  member DetectUrls : bool with get, set
  ...

Full name: System.Windows.Forms.RichTextBox

--------------------
RichTextBox() : unit
type DockStyle =
  | None = 0
  | Top = 1
  | Bottom = 2
  | Left = 3
  | Right = 4
  | Fill = 5

Full name: System.Windows.Forms.DockStyle
field DockStyle.Fill = 5
Multiple items
type Font =
  inherit MarshalByRefObject
  new : prototype:Font * newStyle:FontStyle -> Font + 12 overloads
  member Bold : bool
  member Clone : unit -> obj
  member Dispose : unit -> unit
  member Equals : obj:obj -> bool
  member FontFamily : FontFamily
  member GdiCharSet : byte
  member GdiVerticalFont : bool
  member GetHashCode : unit -> int
  member GetHeight : unit -> float32 + 2 overloads
  ...

Full name: System.Drawing.Font

--------------------
Font(prototype: Font, newStyle: FontStyle) : unit
   (+0 other overloads)
Font(family: FontFamily, emSize: float32) : unit
   (+0 other overloads)
Font(familyName: string, emSize: float32) : unit
   (+0 other overloads)
Font(family: FontFamily, emSize: float32, style: FontStyle) : unit
   (+0 other overloads)
Font(family: FontFamily, emSize: float32, unit: GraphicsUnit) : unit
   (+0 other overloads)
Font(familyName: string, emSize: float32, style: FontStyle) : unit
   (+0 other overloads)
Font(familyName: string, emSize: float32, unit: GraphicsUnit) : unit
   (+0 other overloads)
Font(family: FontFamily, emSize: float32, style: FontStyle, unit: GraphicsUnit) : unit
   (+0 other overloads)
Font(familyName: string, emSize: float32, style: FontStyle, unit: GraphicsUnit) : unit
   (+0 other overloads)
Font(family: FontFamily, emSize: float32, style: FontStyle, unit: GraphicsUnit, gdiCharSet: byte) : unit
   (+0 other overloads)
Multiple items
type FontFamily =
  inherit MarshalByRefObject
  new : name:string -> FontFamily + 2 overloads
  member Dispose : unit -> unit
  member Equals : obj:obj -> bool
  member GetCellAscent : style:FontStyle -> int
  member GetCellDescent : style:FontStyle -> int
  member GetEmHeight : style:FontStyle -> int
  member GetHashCode : unit -> int
  member GetLineSpacing : style:FontStyle -> int
  member GetName : language:int -> string
  member IsStyleAvailable : style:FontStyle -> bool
  ...

Full name: System.Drawing.FontFamily

--------------------
FontFamily(name: string) : unit
FontFamily(genericFamily: Text.GenericFontFamilies) : unit
FontFamily(name: string, fontCollection: Text.FontCollection) : unit
property Control.Controls: Control.ControlCollection
Control.ControlCollection.Add(value: Control) : unit
Control.Show() : unit
Form.Show(owner: IWin32Window) : unit
val show : text:'a -> unit

Full name: Script.show
val text : 'a
property RichTextBox.Text: string
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val x : string list

Full name: Script.x
Multiple items
type DateTime =
  struct
    new : ticks:int64 -> DateTime + 10 overloads
    member Add : value:TimeSpan -> DateTime
    member AddDays : value:float -> DateTime
    member AddHours : value:float -> DateTime
    member AddMilliseconds : value:float -> DateTime
    member AddMinutes : value:float -> DateTime
    member AddMonths : months:int -> DateTime
    member AddSeconds : value:float -> DateTime
    member AddTicks : value:int64 -> DateTime
    member AddYears : value:int -> DateTime
    ...
  end

Full name: System.DateTime

--------------------
DateTime()
   (+0 other overloads)
DateTime(ticks: int64) : unit
   (+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : unit
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : unit
   (+0 other overloads)
property DateTime.Now: DateTime
property DateTime.DayOfWeek: DayOfWeek
type DayOfWeek =
  | Sunday = 0
  | Monday = 1
  | Tuesday = 2
  | Wednesday = 3
  | Thursday = 4
  | Friday = 5
  | Saturday = 6

Full name: System.DayOfWeek
field DayOfWeek.Monday = 1
Raw view Test code New version

More information

Link:http://fssnip.net/2a
Posted:13 years ago
Author:Stefan Knoblauch
Tags: windows forms , debugging