Very Unofficial Visual Studio .NET Compact Edition FAQ
The information below is based on the experiences of local programmers.
Your mileage may vary.
Please do not send in questions asking how to do something -
I don't know how to do it either :-)
What you see is what you get.
- This FAQ currently assumes you have Visual Studio .NET Compact Edition
Beta 1 installed on your machine.
Note: To deploy to the emulator you need to have a network
connection or have the loopback network adapter installed (the README
mentions this). The network adapter is available on
Windows 2000 (not only Windows XP as I felt the README implied).
Some differences betwen Visual Studio .NET and the Compact Edition:
- The Microsoft.Win32 library does not appear to be available. This
means that if you are used to accessing/adding/changing registry values
using the Registry object and associated methods, you are out of luck.
- Things from Graphics2D like applying transforms do not appear to be
available. As an example:
protected override void OnPaint(PaintEventArgs e)
The above code works in VC#.NET "standard" edition but not in CE
as far as I can figure.
I had to change Brushes.Red into new SolidBrush(Color.Red)
and it doesn't seem to want to let me do a RotateTransform at all...
- Control arrays do not appear to be supported in Visual Basic .NET in
general in the same way they were in Visual Basic 6. Visual Basic.NET has
the Microsoft.VisualBasic.Compatability.VB6 library (with things like
ButtonArray, LabelArray, etc.) but CE.NET does not. However,
arrays of controls appear to be allowed, so it might be possible to still
do some of the things you would use a control array for in Visual Basic 6
by creating several controls, adding them to an array and then implementing
events as wrappers to a helper. For example, if you had 10 buttons, you
could have each Button_Click call a helper called MyButtonClick that takes
a parameter to let it know which button had been clicked...
- The ProgressBar object does not have the PerformStep()
method or Step propoerty or Increment() method. Also, it
does not seem to want to let me call CreateGraphics() (which would
be nice to be able to write text onto the progress bar) - it compiles but
crashes at runtime.
- Though there is no Application.ExecutablePath in the
Compact Framework beta, you can get the same effect using:
//Thanks to Ben Bederson
string temp = GetType().Module.FullyQualifiedName;
int lastdir = temp.LastIndexOf('\\');
string appPath = temp.Substring(0, lastdir + 1);
or (with thanks to Adam Clamage) by making sure you add the file you
want to access to the project with the Build Action Property
to Content and then use
access the file from your program.
- The C# TextBox does not act the same as in the full Framework.
For example, when you call AppendText(string) in the full
Framework, the text is appended and if the scrollbar is needed,
the position of the scrollbar's thumb is the bottom rather than the top.
Also, the full Framework has ScrollToCaret that can be used
in conjunction with Select() to specify a 0-length region of text
and then scroll to it.
Compact Framework, I can't find a way to get it to work such that the
thumb gets positioned at the bottom - ie: if I add text to a TextBox
that has more text than can be displayed, it is below the scroll and
the user will have to manually scroll to see it...
- When using threads, one thread essentially owns the GUI as far as
I understand it, and in the Beta release of the Compact Framework the
method you would use (Control.Invoke) is not supported.
I'm currently using the technique of having a Timer's Tick
method do all the GUI interactions - the threads send stuff to and
take things from queues which the Tick method actually feeds
- In Visual C# a Form can have a Form_Paint method called when a Paint event
fires. This method is sent a PaintEventArgs object. This object has a
ClipRectangle memeber that represents the rectange that should be repainted.
However, in the Compact Framework, the ClipRectangle object is always empty.
This page last modified on Saturday, 24-Aug-2002 14:23:36 EDT.