Coffeehouse Thread

16 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

.Net framework source code?

Back to Forum: Coffeehouse
  • User profile image
    ZippyV

    Is there any source available of the Windows Forms controls? It would be helpful to see how they implemented the textbox control, handle dragdrop events, painting events.
    With this code available I would have a good example on how to create my own custom controls.

  • User profile image
    Zeb-3615

    There is - as far as I know - no source code available for the System.Windows.Forms objects.

    The way I do when I want to understand how a WinForms' control is implemented is almost simple : using Lutz Roeder's Reflector, you can reverse engineer a .Net assembly source code (but it does not work with unmanaged code).

    The link : http://www.aisto.com/roeder/dotnet/

    -Zeb-

  • User profile image
    prog_dotnet

    You dont need the source code to implement your own custom controls.
    That is the beauty of good ood. The internal implementation details are hidden; all you need to know is the class members it expose, and inherit from it and/or overriding its methods.
    Hence using bcl/fcl as a base for your own controls.


     

  • User profile image
    draza

    The .NET framework does not include new code for standard windows controls (to my knowledge). Thus, it is useful knowing how things were done before the .NET, using C++/MFC for example. Even then you did not have source code for the controls, but you did not need it so often (only when there was unexplainable behavior).
    In any case, you don't need source code to learn how to build new custom controls, there are several examples in webcasts and popular Windows Forms books. I'd recommend book from Chris Sells.

  • User profile image
    littleguru

    The Reflector, as posted earlier in this thread, is your choice Smiley

  • User profile image
    Charles

    littleguru wrote:
    The Reflector, as posted earlier in this thread, is your choice Smiley


    Yes. Check out Reflector and its associated add-ons. Great tools.

    Charles

  • User profile image
    GrumpyWookie

    prog_dotnet wrote:

    You dont need the source code to implement your own custom controls.
    That is the beauty of good ood. The internal implementation details are hidden; all you need to know is the class members it expose, and inherit from it and/or overriding its methods.



    Yep - we've got a custom text box - inherited from the Windows.Forms.TextBox with overridden key-press events - and a new custom "mode" - so that it can be a numeric only, text, phone, etc.

    And when user hits ENTER key, it raises an event - and skips to next field.

    Very easy to develop - but a bit tricky to debug !

  • User profile image
    W3bbo

    ...I was going to suggest looking at the MONO or GNUNet code.... then I remembered they don't implement GDI+ and use XWindows instead, still... worth a look anyway

    Whilst I thank Microsoft for developing an amazing application framework, it could do with more openness with the developer community.

  • User profile image
    iStation

    Maybe, TextBox in .NET is derived from Edit Control in Win32. So, I think the information of Windows SDK will help you.

    P.S.
    I love the SelectionBackColor property of RichTextBox in Whidbey!
    Thanks MS.
    Smiley

  • User profile image
    littleguru

    Charles wrote:
    littleguru wrote: The Reflector, as posted earlier in this thread, is your choice Smiley


    Yes. Check out Reflector and its associated add-ons. Great tools.

    Charles


    Are you guys internally also using the Reflector?

  • User profile image
    prog_dotnet

    You could also use the Salamander .NET decompiler and .NET Explorer from Remotesoft

    http://www.remotesoft.com/salamander/index.html


  • User profile image
    Sampy

    littleguru wrote:
    Charles wrote:
    littleguru wrote: The Reflector, as posted earlier in this thread, is your choice Smiley


    Yes. Check out Reflector and its associated add-ons. Great tools.

    Charles


    Are you guys internally also using the Reflector?


    For the .Net framework? No.

    I just do a cd to <path>\clr\src and poke around Smiley

  • User profile image
    littleguru

    Sampy wrote:
    For the .Net framework? No.

    I just do a cd to <path>\clr\src and poke around Smiley


    Must be fun! I have always to use the Reflector. Sad

  • User profile image
    Sampy

    Actually, that's not what I do. I do one of two things:

    1) Use an internal website called ddindex (developer division index). It uses Windows indexing service to index all of the source code for Visual Studio and the Framework and allows you to do really fast full text searches. Helpful when you want to know who's calling your function.

    2) I press F11 (step into). We put all the symbols on a symbol server (called symbols) and new in VS 2005, you can point VS at this server and it will find exactly what you need. I think that other Windows debuggers have been able to do this in the past but it's nice to see VS doing it. This way I can step into any source code I need to see in the framework.

    That being said, I don't do that very often. Unless I'm using something new for Whidbey (like the super sweet DataGridView, this thing rocks!), I usually have very little need to see what's going on under the hood. MSDN is usually good enough for me. We also have a site that allows you to walk the class hierarchy of everything in the framework that is built dynamically against daily builds (it's not build every day but usually once a week I think).

    .Net makes this all possible. I love metadata!

  • User profile image
    Mike Dimmick

    Sampy wrote:
    2) I press F11 (step into). We put all the symbols on a symbol server (called symbols) and new in VS 2005, you can point VS at this server and it will find exactly what you need. I think that other Windows debuggers have been able to do this in the past but it's nice to see VS doing it.


    Actually VS.NET 2002 and 2003 are both capable of using a symbol server. See HOW TO: Use a Symbol Server with the Visual Studio .NET Debugger for VS.NET 2002. For VS.NET 2003 you simply need to follow the second half of the steps, under 'Specify the Path to the Symbol Server', or set the _NT_SYMBOL_PATH environment variable.

    The public symbol server contains less information than Microsoft's internal private ones, IIRC. There are ways to strip private information from the symbols, such as line numbers and names of static variables and functions (C/C++ functions, that is). John Robbins developed an application PrivateStrip which you can use to do this for your applications.

    I do a lot of Windows CE / Pocket PC programming and one of the things I miss is a set of public symbols for the OS. It's incredibly frustrating to get an exception in the middle of a system routine and have no idea where you are or how you got there. I have learned how to trace an ARM-architecture stack backwards and get back into my own code, but it's extremely time-consuming and painful.

  • User profile image
    cae

    Excuse my lack of knowledge, but I don't know how to setup a database server and assign it in Visual C# express 2005. Could you help me please ?

    Once done, is it really possible to step into the dotnet framework 2.0 code and see variables value ?

    Thank you

    Herve

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.