Briefly describe how to use the PrintDocument component to print a document. Discuss maintaining correct line spacing and multipage documents.

1 Answer

Answer :

The PrintDocument class exposes the Print method, which raises the PrintPage event. Code to render printed items to the printer should be placed in the PrintPage event handler. The PrintPage event handler provides the objects required to render to the printer in an instance of the PagePrintEventArgs class. Content is rendered to the printer using the Graphics object provided by PagePrintEventArgs. You can calculate correct line spacing by dividing the height of the MarginBounds property by the height of the font you are rendering. If your document has multiple pages, you must set the PagePrintEventArgs.HasMorePages property to true, which causes the PrintPage event to fire again. Because the PrintPage event handler retains no inherent memory of how many pages have been printed, you must incorporate all logic for printing multiple pages into your event handler.

Related questions

Description : Briefly describe the major components of the .NET Framework and describe what each component does.

Last Answer : The .NET Framework consists of two primary parts: the common language runtime, which manages application execution, enforces type safety, and manages memory reclamation, and the .NET base class library, which consists of thousands of predeveloped classes that can be used to build applications.

Description : Briefly discuss the advantages and disadvantages of using typed DataSet objects.

Last Answer : Typed DataSet objects allow you to work with data that is represented as members of the .NET common type system. This allows your applications to be aware of the types of data returned in a DataSet and serves ... if you do not know the structure of your data, and can be used with any data source. 

Description : Briefly describe the five accessibility requirements of the Certified for Windows logo program.

Last Answer : The five requirements are o Support standard system settings. This requires your application to be able to conform to system settings for colors, fonts, and other UI elements. o Be ... information by sound alone. This requirement can be met by providing redundant means of conveying information.

Description : Briefly describe the three types of user-developed controls and how they differ.

Last Answer : The three types of user-developed controls are inherited controls, user controls, and custom controls. An inherited control derives from a standard Windows Forms control and inherits the ... inherit only generic control functionality. All specific functionality must be implemented by the developer.

Description : What are the four major parts of a SQL SELECT statement? Briefly describe each one.

Last Answer : The four major parts of a SELECT statement are SELECT, FROM, WHERE, and ORDER BY. SELECT specifies the fields to be retrieved. FROM specifies the table from which the records are to be retrieved. WHERE ... the records to be retrieved, and ORDER BY allows you to specify a sort order for the records.

Description : Briefly describe an XmlDataDocument and how it relates to a DataSet.

Last Answer : An XmlDataDocument is an in-memory representation of data in a hierarchical XML format. Each XmlDataDocument is synchronized with a DataSet. Whenever changes are made to one object, the other is instantly updated. Thus, you can use the XmlDataDocument to perform XML manipulations on a DataSet.

Description : What are the two kinds of multidimensional arrays? Briefly describe each.

Last Answer : Multidimensional arrays can be either rectangular arrays or jagged arrays. A rectangular array can be thought of as a table, where each row has the same number of columns. Rectangular arrays with ... dimensional jagged array is like a table where each row might have a different number of columns.

Description : Briefly describe how a class is similar to a structure. How are they different?

Last Answer : Both classes and structures can have members such as methods, properties, and fields, both use a constructor for initialization, and both inherit from System.Object. Both classes and structures can be ... are value types, and the memory that holds structure instances is allocated on the stack. 

Description : Briefly describe what members are, and list the four types of members.

Last Answer : Members are the parts of a class or a structure that hold data or implement functionality. The primary member types are fields, properties, methods, and events.

Description : Briefly describe how garbage collection works.

Last Answer : The garbage collector is a thread that runs in the background of managed .NET applications. It constantly traces the reference tree and attempts to find objects that are no longer referenced. When a nonreferenced object is found, its memory is reclaimed for later use.

Description : Briefly highlight the differences between imperative and declarative security as they pertain to code access security.

Last Answer : Imperative security is implemented by calling methods of Permission objects in code at run time. Declarative security is configured by attaching attributes representing permissions to classes ... request assembly-wide permissions using the Assembly (assembly) directive with declarative security.

Description : Briefly contrast connected and disconnected data access in ADO.NET.

Last Answer : In ADO.NET, connected data access is available through the DataReader, which is a lightweight class designed to provide very fast and efficient data access. It is severely limited, however, in ... to update the database and keeping the connection open just long enough to execute those commands.

Description : Briefly explain encapsulation and why it is important in object-oriented - programming.

Last Answer : Encapsulation is the principle that all of the data and functionality required by an object be contained by that object. This allows objects to exist as independent, interchangeable units of functionality without maintaining dependencies on other units of code.

Description : Briefly explain how to convert a string representation of a number to a numeric type, such as an Integer or a Double.

Last Answer : All numeric data types have a Parse method that accepts a string parameter and returns the value represented by that string cast to the appropriate data type. You can use the Parse method of each data type to convert strings to that type.

Description : Briefly summarize the similarities and differences between arrays and collections.

Last Answer : Arrays and collections allow you to manage groups of objects. You can access a particular object by index in both arrays and collections, and you can use For Each Next (foreach) syntax to iterate ... Collections namespace can grow or shrink dynamically, and items can be added or removed at run time.

Description : Briefly explain the difference between Public (public), Friend (internal), and Private (private) access levels as they apply to user-defined types and members.

Last Answer : In user-defined types, Public (public) classes can be instantiated by any element of the application. Friend (internal) classes can be instantiated only by members of the same assembly, and Private ( ... the same assembly, and Private (private) members can be accessed only from within the type. 

Description : Briefly explain what is meant by a reference type and a value type.

Last Answer : A value type holds all of the data represented by the variable within the variable itself. A reference type contains a reference to a memory address that holds the data instead of the actual data itself. 

Description : Explain how to use the PrintPreviewDialog control to display a preview of a printed document before it is printed.

Last Answer : You display a preview of a printed document with the PrintPreviewDialog control by first setting the PrintDocument property of the PrintPreviewDialog instance to the PrintDocument you want to preview, then by calling the PrintPreviewDialog.Show command to display the dialog box. 

Description : Explain how to use the HelpProvider component to provide help for UI elements.

Last Answer : You can provide either a HelpString or a help topic for UI elements with the HelpProvider. The HelpProvider provides HelpString, HelpKeyWord, and HelpNavigator properties for each control on the form. If ... particular element is displayed when the element has the focus and the F1 key is pressed.

Description : Mark the correct option a) Documents means any matter expressed or described upon any substance b  means of letter, figures or marks. b) Words printed, lithographed or photographed are documents c) A ... d) An inscription on a metal plate or stone and caricature are documents. e) All the above

Last Answer : e) All the above

Description : HTML is a markup language for describing web documents (web pages). Which among the following features is correct about HTML: a) HTML stands Hyper Text Markup Language b) A Markup language is a set ... tags d) Each HTML tag describes different document content e) None of These f) All of the Above

Last Answer : f) All of the Above

Description : Which of the following is correct about margins: a) all sections in a document need to have the same margin b) different sections can have different margins c) word have predefined margin setting for all documents d) can not say depend on the version of word e) None of The Above

Last Answer : b) different sections can have different margins

Description : Describe how to use code to retrieve resources at run time.

Last Answer : You must first create an instance of the ResourceManager class that is associated with the assembly that contains the desired resource. You can then use the GetString method to retrieve string resources or the GetObject method to retrieve object resources.

Description : Describe how to use a DataView to filter or sort data.

Last Answer : You can apply sort criteria to a DataView by setting the Sort property to the name of a column or columns to be sorted by. The data represented in a DataView object can be filtered by setting the RowFilter property to a valid filter expression.

Description : Describe a general strategy for creating a setup project that terminates installation if a specific file is not already installed on the target machine.

Last Answer : First, create a file search to search the file system for the specific file. Then create a launch condition to evaluate the results of the search. You can connect the launch condition to ... in the search's Property property in the expression specified by the launch condition's Condition property. 

Description : Describe XCOPY deployment. Under what conditions is it useful? When can it not be used?

Last Answer : XCOPY deployment is a simple method of deployment where the DOS command XCOPY is used to copy the application directory and any subdirectories to the target machine. You can use XCOPY ... an application requires a more complex deployment or references shared assemblies, you cannot use XCOPY.

Description : Describe how to sign your assembly with a strong name. Why would you want to do this?

Last Answer : To sign your assembly with a strong name, you must have access to a key file or create one with the strong name utility (sn.exe). You then specify the key file in the AssemblyInfo file and ... identity, a strong name is required if you want to install your assembly to the Global Assembly Cache.

Description : Describe how to create localized versions of a form.

Last Answer : To create a localized version of a form, set the Localizable property to true. Then set the Language property to the language/region for which you want to create the localized form. Make ... be stored in resource files and loaded when the CurrentUICulture is set to the appropriate CultureInfo. 

Description : Describe how to create a form or control with a nonrectangular shape.

Last Answer : Set the Region property of the form or control to a Region object that contains the irregular shape. You can create a Region object from a GraphicsPath object.

Description : Describe the role of the LicenseProvider in control licensing.

Last Answer : The LicenseProvider controls license validation and grants run-time licenses to validly licensed components. The LicenseManager.Validate method checks for an available license file and checks ... of LicenseProvider. You specify which LicenseProvider to use by applying the LicenseProviderAttribute. 

Description : Describe the general procedure for rendering text to a drawing surface.

Last Answer : You must first obtain a reference to a Graphics object. Next, create an instance of a GraphicsPath object. Use the GraphicsPath.AddString method to add text to the GraphicsPath. Then, call the Graphics.DrawPath or Graphics.FillPath to render the text.

Description : Describe the roles of Graphics, Brush, Pen, and GraphicsPath objects in graphics rendering.

Last Answer : The Graphics object represents a drawing surface and encapsulates methods that allow graphics to be rendered to that surface. A Brush is an object that is used to fill solid shapes, and a Pen ... lines. A GraphicsPath object represents a complex shape that can be rendered by a Graphics object.

Description : Describe Break mode and some of the available methods for navigating in Break mode.

Last Answer : Break mode allows you to observe program execution on a line-by-line basis. You can navigate program execution in Break mode by using Step Into, Step Over, Step Out, Run To Cursor, and Set Next Statement.

Description : Describe an abstract class and explain when one might be useful.

Last Answer : An abstract class is a class that cannot be instantiated but must be inherited. It can contain both implemented methods and abstract methods, which must be implemented in an inheriting class. ... common interface for other methods, and leave more detailed implementation up to the inheriting class.

Description : Describe in general terms how to add a control to a form at run time.

Last Answer : You must first declare and instantiate a new instance of the control. Then, you must add the control to the form�s Controls collection. Once the control has been added to the Controls collection, you must manually set properties that govern the control�s position and appearance.

Description : Describe how to retrieve the ASCII key code from a keystroke. How would you retrieve key combinations for non-ASCII keys?

Last Answer : Keystrokes can be intercepted by handling the KeyPress and KeyDown events. Both of these events relay information to their handling methods in the form of their EventArgs. The KeyPressEventArgs, ... you would handle the KeyDown event and use the properties exposed by the KeyEventArgs instance.

Description : Describe what is meant by field-level validation and form-level validation.

Last Answer : Field-level validation is the process of validating each individual field as it is entered into a form. Form-level validation describes the process of validating all of the data on a form before submitting the form.

Description : Describe two ways to set the tab order of controls on your form.

Last Answer : You can set the tab order in Visual Studio by choosing Tab Index from the View menu and clicking each control in the order you desire. Alternatively, you can set the TabIndex property either in code or in the Properties window.

Description : Explain what constructors and destructors are and describe what they are used for.

Last Answer : The constructor is the method that initializes a class or structure and is run when a type is first instantiated. It is used to set default values and perform other tasks required by the class. ... reclaimed by garbage collection. It contains any code that is required for cleanup of the object. 

Description : Describe the accessibility modifier “protected internal”. 

Last Answer : It is available to classes that are within the same assembly and derived from the specified base class.

Description : Name and describe 5 different documentation tags.

Last Answer : /// <value></value> /// <example></example> /// <exception cref=""></exception> /// <include file='' path='[@name=""]'/> /// ... cref=""/> /// <seealso cref=""/> /// </summary>

Description : Describe garbage collection (in simple terms).

Last Answer : Garbage collection eliminates uneeded objects. 1. the new statement allocates memory for an object on the heap. 2. When no objects reference the object it may be removed from the heap (this is a non deterministic process). 3. Finalize is called just before the memory is released.

Description : Describe Jump statements: break, continue, and goto. 

Last Answer : Break terminates a loop or switch. Continue jumps to the next iteration of an enclosing iteration statement. Goto jumps to a labelled statement.

Description : Describe an operator from each of these categories:

Last Answer : Arithmetic: + Logical (boolean and bitwise): & String concatenation: + Increment, decrement: ++ Shift: >> Relational: == Assignment: = Member access: . Indexing: [] Cast: () ... : + Object creation: new Type information: as Overflow exception control: checked Indirection and Address: *

Description : Describe 5 numeric value types ranges. 

Last Answer : sbyte -128 to 127, byte 0 – 255, short -32,768 to 32,767, int -2,147,483,648 to 2,147,483,647, ulong 0 to 18,446,744,073,709,551,615 

Description : Describe the accessibility modifier “protected internal”. 

Last Answer : It is available to classes that are within the same assembly and derived from the specified base class.

Description : Describe the accessibility modifier protected internal. 

Last Answer : It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in). 

Description : Extra spacing between paragraphs adds emphasis and makes a document easier to read. -Technology

Last Answer : TrueThe document can be easily read, if the extra spacing is given between paragraphs it makes the document very attractive.

Description : in word 2007 how do you delete spacing between lines in document

Last Answer : I have no answer. I have the same problem.