VSLab Regression tests and doc

by cisterni 28. September 2008 18:30

I've just added a project for regression tests in VSLab. It is also interesting because it shows very simple viewlets doing simple things and it can also be a good way to learn Viewlet development. So far there are two viewlets checking mouse move and resize events. Here is the code:


open System.Drawing

open VSLab

type ShowStringViewlet() =  inherit Viewlet()



  val mutable displayString : string


  override self.OnPaint(e) =     let g = e.Graphics

    g.DrawString(self.displayString, self.Font, Brushes.Black, 0.0f, 0.0f)


MouseMotionViewlet() as x =  inherit ShowStringViewlet()


  do x.displayString <- "Move the mouse inside the area"


  override self.OnMouseMove(e) =     self.displayString <- sprintf "x: %d, y: %d" (e.X) (e.Y)

    self.Invalidate(new Rectangle(0, 0, 200, 50))

let mmv = new MouseMotionViewlet()




ResizeViewlet() as x =  inherit ShowStringViewlet()


  do x.displayString <- "Resize the viewlet"


  override x.OnSizeChanged (e) =

    x.displayString <- sprintf "Size is (%d, %d)" (x.Width) (x.Height)

let rv = new ResizeViewlet()




 I hope this can be useful.

Currently rated 1.5 by 2 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

General | Viewlets

Powered by BlogEngine.NET
Theme by Mads Kristensen

VSLab blog

VSLab is a Visual Studio extension designed to support Visual Studio interaction from F# interactive. It is a Microsoft product developed at University of Pisa, by a team lead by Antonio Cisternino.


Recent comments

Comment RSS


The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008