C# QA Part - One

Q. Can I show pictures of file types other than BMP and JPG?

A. Yes. The PictureBox supports the display of images with the extensions BMP, JPG, ICO, EMF, WMF, and GIF. The PictureBox

can even save images to a file using any of the supported file types.

Q. Is it possible to show pictures in other controls?

A. The PictureBox is the control to use when you are just displaying images. However, many other controls allow you to display

pictures as part of the control. For instance, you can display an image on a button control by setting the button's Image property to a

valid picture.

Q. How can I easily get more information about a property when the Description section of the Properties window just doesn't cut it?

A. Click the property in question to select it, and then press F1context-sensitive help applies to properties in the Properties window,

as well.

Q. I find that I need to see a lot of design windows at one time, but I can't find that "magic" layout. Any suggestions?

A. Run at a higher resolution. Personally, I won't develop in less than 1024x768. As a matter of fact, all my development machines

have two displays, both running at 1152x864. You'll find that any investment you make in having more screen real estate will pay you

big dividends.

Q. Is there an easy way to get help about an object's member?

A. Absolutely. Visual C#'s context-sensitive Help extends to code as well as to visual objects. To get help on a member, write a code

statement that includes the member (it doesn't have to be a complete statement), position the cursor within the member text, and

press F1. For instance, to get help on the int data type, you could type int, position the cursor within the word int, and press F1.

Q. Are there any other types of object members besides properties and methods?

A. Yes. An event is actually a member of an object, although it's not always thought of that way. Although not all objects support

events, most objects do support properties and methods.

Q. Is it possible to create custom events for an object?

A. Yes, you can create custom events for your own objects (you'll learn about such objects in Hour 16, "Designing Objects Using

Classes"), and you can also create them for existing objects. Creating custom events, however, is beyond the scope of this book.

Q. Is it possible for objects that don't have an interface to support events?

A. Yes. To use the events of such an object, however, the object variable must be dimensioned a special way or the events aren't

available. This gets a little tricky and is beyond the scope of this book.

Q. How many form properties should I define at design time as opposed to runtime?

A. You should set all properties that you can at design time. First, it'll be easier to work with the form because you can see exactly

what the user will see. Also, debugging is easier because there's less code.


Q. Should I let the user minimize and maximize all forms?

A. Probably not. First, there's no point in letting a form be maximized if the form isn't set up to adjust its controls accordingly. About

forms, print dialog boxes, and spell check windows are examples of forms that should not be resizable.

Q. Do I need to worry about the anchoring and scrolling capabilities of every form I create?

A. Absolutely not. The majority of forms in most applications are dialog boxes. A dialog box is a modal form used to gather data

from the user. A dialog box is usually of a fixed size, which means that its border style is set to a style that can't be sized. With a

fixed-size form, you don't need to worry about anchoring or scrolling.

No comments: