|
|
|
|
|
Total Hits: 934 | Today: 0
|
Author: Wrox Publishing
|
Rating:
|
|

This is chapter 21 of the book Professional C# from Wrox Publishing, titled Graphics with GDI+. It shows you how to use GDI+ to create a customised user interface. It explains how to create items within the area of the screen covered by your application, and will show you how to use your code to control them....
|
|
|
|
Total Hits: 413 | Today: 0
|
|
Rating:
|
|

IN MOST PROGRAMMING LANGUAGES, some information is expressed through declaration,and other information is expressed through code. For example, in the following class member declaration public int Test;the compiler and runtime will reserve space for an integer variable and set its protection so that it is visible everywhere. This is an example of declarative information;it’s nice because of the economy of expression and because the compiler handles the details for us.Typically, the types of de...
|
|
|
|
Total Hits: 655 | Today: 1
|
Author: Jeff Louie
|
Rating:
|
|

A problem that comes up repeatedly is how to load a class dynamically at run time given the name of the class (as a string) and the name of the assembly that contains the class (eg. AssemblyName.dll). In a sense, the runtime fully qualified name is the assembly name pre-pended to the fully qualified class name....
|
|
|
|
Total Hits: 734 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

In Chapter two I alluded to the power of abstract classes (and interfaces). In this chapter I am going to demonstrate how to implement a plug in architecture using an interface and the power of dynamic reflection. In this chapter I am going to demonstrate the use of encapsulation and polymorphism to allow the dynamic loading of a "plug in" class at runtime. The loading of a third party plug in class at runtime is useful when you want to add new functionality to an existing program. Since the ap...
|
|
|
|
Total Hits: 308 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

The .NET framework has built in support for object persistence using serialization. This is done using Serialization.Formatters.Binary or Serialization.Formatters.Soap in the System.Runtime namespace. As long as the objects in the serialization graph support serialization, adding object persistence to the Draw program is surprisingly easy....
|
|
|
|
Total Hits: 292 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

It's time for another break from theory and on to some real world programming challenges. In this chapter, you take a detour into the world of gumption traps. A gumption trap is a situation that is so frustrating that it sucks the "gumption" or energy out of you. Surprisingly, a lot of gumption traps come from preconceived notions of what "should" be correct. C++ and Java programmers are prone to gumption traps due to their assumptions about the C# language. In other words, C++ and Java programm...
|
|
|
|
Total Hits: 395 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

Enough theory. It's time to code! In this chapter, you will learn about the most basic design pattern, the Model--View/Controller architecture (M-VC). This lesson contains the complete source code of a Model class that encapsulates the complex math required to do mortgage calculations. You will then create a working Mortgage calculator as a Windows Form application. Finally, you will reuse the Model class to create a working calculator as a Web Form application. This is all working C# code that ...
|
|
|
|
Total Hits: 372 | Today: 0
|
Author: Tom Dziedzic.
|
Rating:
|
|

I have been interested in making electronic components not just for the computer but for the everyday life and self entertainment. I wanted to make all the calculations from ohm's law into a simple program that will enable quick calculations while using the .net framework v.2.0 and in the process using a new language: C#, normally I use C++ but I wanted to switch to the newest technologies out so far. Anyways I have found alot about computer programming like an interesting fact is that the .net ...
|
|
|
|
Total Hits: 473 | Today: 0
|
Author: Salman Ahmed
|
Rating:
|
|

This method finds all the substrings in a string that are seperated by one or more characters, returning a string array. This method also has 1 overload where you can specifiy the maximum number of elements in an array to return from the string....
|
|
|
|
Total Hits: 372 | Today: 0
|
Author: Charles Carroll
|
Rating:
|
|

The code below calls "Utility Belt" functions. The Array Manipulation Code is one demo of Array "Utility Belt" functionality including tracing of arrays and datatables....
|
|
|
|
Total Hits: 556 | Today: 0
|
Author: Joel Murach
|
Rating:
|
|

Become the C# developer that companies compete for. Whether you’re new to C# or upgrading to 2005, this book teaches you how to develop 3-layer Windows Forms applications that do database processing…the applications that businesses rely on each day....
|
|
|
|
Total Hits: 719 | Today: 0
|
Author: Wrox
|
Rating:
|
|

In this chapter we're going to look at the base classes – the vast number of .NET classes that Microsoft has written for you, and also namespaces – the system by which classes are grouped together.A significant part of the power of the .NET framework comes from the base classes supplied by Microsoft as part of the .NET framework. These classes are all callable from C# and provide the kind of basic functionality that is needed by many applications to perform, amongst other things, basic system, W...
|
|
|
|
Total Hits: 423 | Today: 0
|
Author: Jesse Liberty
|
Rating:
|
|

When a head of state dies, the president of the United States typically does not have time to attend the funeral personally. Instead, he dispatches a delegate. Often this delegate is the vice president, but sometimes the VP is unavailable and the president must send someone else, such as the secretary of state or even the first lady. He does not want to “hardwire” his delegated authority to a single person; he might delegate this responsibility to anyone who is able to execute the correct ...
|
|
|
|
Total Hits: 334 | Today: 0
|
|
Rating:
|
|

Besides calling into interfaces that are implemented by library classes,many .NET classes call standard interfaces. If we provide our own implementation of such interfaces, we can have .NET library code call our own code in appropriate ways, customizing the behavior of library code. We will look at examples, including object cloning and comparison of objects. This behavior of your program being called into has traditionally been provided by “callback” functions. In C# there is a type-safe, objec...
|
|
|
|
Total Hits: 506 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

In Chapter 7, we investigated the conundrum of using implementation inheritance versus containment. Some authors have argued that composition or containment by ownership is generally preferable to implementation inheritance. Joshua Block argues in "Effective Java" to "favor composition over inheritance." He quotes Snyder that "Unlike method invocation, inheritance breaks encapsulation." He concludes that since "a subclass depends on the implementation details of its super class for its proper fu...
|
|
|
|
Total Hits: 619 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

In this chapter we are going to further explore the subject of interfaces. We are going to investigate the challenges of designing an interface, using composite interfaces and providing skeletal abstract classes. In Chapter 13, we defined an interface IDrawable to enable a plug-in architecture. Trying to modify the IDrawable interface provides a good example of the challenges of an evolving interface design....
|
|
|
|
Total Hits: 641 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

In Chapter 13, I demonstrated the use of encapsulation and polymorphism to load a plug-in at runtime. In this chapter, I am going to demonstrate how to use the IComparer interface to reuse the generic sort and binary search algorithm provided by the ArrayList class. The ArrayList class defers the final implementation of the sort and binary search algorithm to a more knowledgeable class. The more knowledgeable class must provide a useful concrete implementation of the IComparer interface. Properl...
|
|
|
|
Total Hits: 284 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

Some would argue that indirection is a basic principle of OOP (object oriented programming) and a basic tenant of Software Engineering 101. The concept of a class that encapsulates or hides the actual implementation details can be considered an example of the use of indirection. In this example, the use of indirection adds flexibility and eases code maintenance. A closely related, but poorly defined topic in software engineering, is the concept of loose coupling....
|
|
|
|
Total Hits: 287 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

It is surprisingly easy to add full printing support to our Draw program. Although this is certainly a detour from the topic of object oriented programming, it is just too cool to skip. You can add "Page Setup", "Print Dialog" and "Print Preview" support to the Draw program by simply dragging the controls onto the Draw form! Read the chapter to learn more!...
|
|
|
|
Total Hits: 217 | Today: 0
|
Author: Jeff Louie
|
Rating:
|
|

In this brief chapter, we examine the problem of backward compatibility. If we add a new "fill" feature to the DrawableShape class, it is desirable that this new feature does not break the existing Draw application. One way to solve this problem is to rely on our decision to program to the IDrawableShape interface and the ability of the DrawYourself method to encapsulate or hide the actual implementation of the drawing behavior. In this chapter we create a new interface IFillable, implement the ...
|
|
|
|
|
|