MORE INFORMATION
Page 4: Creating An Empty Project Only Valid For Visual Studio.Net
On page 4, there is a description on how to create an empty
project. The option of creating an empty project is available with Visual
Studio .NET, but not with Visual C# .NET Standard Edition.
We have
made available a file that allows you to add an empty project in Visual C#
.Net.
Download and save the file emptypro.exe onto your hard disk,
then double-click the file to extract the file CSharpExForEmptyProject.vsdir
into the \Program Files\Microsoft Visual Studio .NET\VC#\CSharpProjects folder.
The following
file is available for download from the Microsoft Download
Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
CD-ROM: New ImageIO.cs And MetafileConvert.cs Files
On the companion CD, files ImageIO.cs (\Code\Dialog
Boxes\ImageIO) and MetafileConvert.cs (\Code\Metafiles\MetafileConvert) contain
errors in their code. The files with the corrected code are available now for
download.
The
following file is available for download from the Microsoft Download
Center:
For
additional information about how to download Microsoft Support files, click the
following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on secure servers that prevent any unauthorized
changes to the file.
Page 12: Typographical Error
There is a typographical error on page 12 in the
second-to-the-last paragraph. Change:
"Date types don't need..."
To:
"Data types don't need..."
Page 14: Correction To AddFive Routine
On page 14, in the AddFive routine,
Change:
"i +
5;"
To:
"i += 5;"
Page 45: Int16 Should Be Int32
There are two incorrect references to Int16 in the middle of page
45.
Change:
"is an alias for the Int16 structure."
To:
"is an alias for the Int32 structure."
Also
change:
"System.Int16 a = 55;"
To:
"System.Int32 a =
55;"
Page 56: Missing ")" In Code Sample
There is an error in the "switch and case" construction coding example at the bottom of page 56. The end of line four is missing a closing parenthesis.
Change:
switch (MessageBox.Show("Do you want to create a new file?",
"WonderWord",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question)
{
case DialogResult.Yes:
// "Yes" processing
break;
To:
switch (MessageBox.Show("Do you want to create a new file?",
"WonderWord",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question))
{
case DialogResult.Yes:
// "Yes" processing
break;
Pages 116 & 118: SystemColor Should Be SystemColors
There is an error in the code samples on page 116 and 118. The
four instances total of "SystemColor" on pages 116 and 118 should be changed to
"SystemColors".
Page 203: Incorrect Chapter Cross-Reference In First Paragraph Of
Page
In the first paragraph on page 203, in the fourth
line,
Change:
"find out about in Chapter 11...."
To:
"find out about in Chapter 13...."
Page 244: Incorrect Capitalization In Code Sample
The beginning of the Caret class towards the bottom of Page 244 contains five instances of the following program instruction:
[DLLImport("user32.dll")]
When the reader attempts to compile the Caret.cs file, the following error message is thrown:
...\Caret.cs(13): The type or namespace name 'DLLImport' could not be found (are you missing a using directive or an assembly reference?)
The reason the compiler generated this error is because the two letter "L's" in the word "DLLImport" are capitalized. (Please note an example of the proper way to write this statement can be found on the sixth line of Page 239.)
Error Solution:
Change the two upper case letter "L's" to lower case letter "l's."
Correction:
The beginning of the Caret class towards the bottom of Page 244 should contain five instances of the following program instruction:
[DllImport("user32.dll")]
Pages 252 and 253: Incorrect Hebrew Character Leading To Misspelling Of "Boker"
In the second paragraph of the "Right-to-Left Problems" section on
page 252, in the second line, replace the sentence that is there with the
following:
"We're going to type the Hebrew for 'good morning,' which
is ???? ???, commonly transliterated as boker tov."
In the second
sentence of the second paragraph under the table on page 253, replace the
sentence "So to type...(the c key)." with the following:
"So, to type
the Hebrew phrase shown above into TypeAway, you need to type the letters in
this order: bet (the c key), vav (the u key) qof (the e key), resh (the r key),
space, tet (the y key), vav (the u key), and bet (the c key)."
Page 289: Incorrect Square Roots Within Graphic At Top Of Page
On page 289, in the graphic (G07PL09) on the top of page 289, all
instances (8) showing the square root of 2 should instead show the square root
of 1/2.
Page 298: OnPage Should Be DoPage
There are two typographical errors at the bottom of page
298.
Change:
"The OnPage method changes..."
To:
"The DoPage method changes..."
Change:
"OnPage then
switches..."
To:
"DoPage then switches..."
Page 382: Remove Extra Space From Code
The seventh line from the end of the AllAboutFont.cs program located on Page 382 states:
"GdiVerticalFont : " + Font.GdiVerticalFont + "\n" +
Remove the space between the Font property and the colon character in the aforementioned line and in the program's output display window at the bottom of Page 382.
This line should read:
"GdiVerticalFont: " + Font.GdiVerticalFont + "\n" +
Page 403: Two Incorrect Values In TestRenderingHint Enumeration
Table
On page 403, In the TextRenderingHint Enumeration table,
the fourth and fifth lines should be switched and the values in the second
column changed. Change the fourth row from:
"AntiAlias 3
Anti-aliasing, no grid fitting"
To:
"AntiAliasGridFit 3
Anti-aliasing with grid fitting"
And Change the fifth row
from:
"AntiAliasGridFit 4 Anti-aliasing with grid fitting"
To:
"AntiAlias 4 Anti-aliasing, no grid fitting"
Page 416: How the DrawString Should Be How does the Drawstring
There is a typographical error in the middle of page
416.
Change:
"How the DrawString call interprets
ampersands?"
To:
"How does the DrawString call interpret
ampersands?"
Page 472: Error In Code Sample
On page 472, there is an error in the JeuDeTaquin.cs code sample.
Change:
"BorderStyle = FormBorderStyle.Fixed3D;"
To:
"FormBorderStyle = FormBorderStyle.Fixed3D;"
Page 484: Out-of-date Info In Paragraph
On page 484, in the section titled "Bitmap File Formats",
Change:
"Exif The Exchangeable image format was developed by the organization now known as Japan Electronic Industry Development Association (JEIDA) for use in digital cameras. The specification is published on the Web site of the International Imaging Industry Association (I3A), formerly the Photographic and Imaging Association, Inc. (PIMA) at http://www.pima.net/standards/it10/PIMA15740/Exif_2-1.PDF."
To:
"Exif The Exchangeable image format was developed by the organization now known as Japan Electronics and Information Technology Industries Association (JEITA) for use in digital cameras. The specification for EXIF 2.2 can be found here: http://www.exif.org/Exif2-2.PDF.
"
Page 489: Incorrect URL
The ImageFromWeb.cs program defines an incorrect string variable named 'strUrl' located approximately in the middle of Page 489.
Change:
"string strUrl =
"http://images.jsc.nasa.gov/images/pao/AS11/10075267.jpg";"
To:
"string strUrl =
"http://images.jsc.nasa.gov/lores/AS11-40-5903.jpg";"
Page 515: Correction To Save Method
On page 515, in first paragraph under "More on the Image Class",
remove:
"The first version of Save in the following list uses the
filename extension to determine the file Format, but you can be more explicit
in the next two versions:
...
void Save(string strFilename)"
Page 770: Single Class Should Be Single Structure
There is an incorrect statement in the middle of the third
paragraph on page 770.
Change:
"The point size has to be
converted from a string back to a float using the static Parse method of the
Single class."
To:
"The point size has to be converted from a
string back to a float using the static Parse method of the Single
structure."
Pages 779 and 780: Correction To ImageIO.cs Code
On pages 779 and 780, replace the ImageIO.cs code with the
following:
//--------------------------------------
// ImageIO.cs (c) 2001 by Charles Petzold
//--------------------------------------
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
class ImageIO: ImageOpen
{
MenuItem miSaveAs;
public new static void Main()
{
Application.Run(new ImageIO());
}
public ImageIO()
{
Text = strProgName = "Image I/O";
Menu.MenuItems[0].Popup += new EventHandler(MenuFileOnPopup);
miSaveAs = new MenuItem("Save &As...");
miSaveAs.Click += new EventHandler(MenuFileSaveAsOnClick);
Menu.MenuItems[0].MenuItems.Add(miSaveAs);
}
void MenuFileOnPopup(object obj, EventArgs ea)
{
miSaveAs.Enabled = (image != null);
}
void MenuFileSaveAsOnClick(object obj, EventArgs ea)
{
SaveFileDialog savedlg = new SaveFileDialog();
savedlg.InitialDirectory = Path.GetDirectoryName(strFileName);
savedlg.FileName = Path.GetFileNameWithoutExtension(strFileName);
savedlg.AddExtension = true;
savedlg.Filter = "Windows Bitmap (*.bmp)|*.bmp|" +
"Graphics Interchange Format (*.gif)|*.gif|" +
"JPEG File Interchange Format (*.jpg)|" +
"*.jpg;*.jpeg;*.jfif|" +
"Portable Network Graphics (*.png)|*.png|" +
"Tagged Imaged File Format (*.tif)|*.tif;*.tiff";
ImageFormat[] aif = { ImageFormat.Bmp, ImageFormat.Gif,
ImageFormat.Jpeg, ImageFormat.Png,
ImageFormat.Tiff };
if (savedlg.ShowDialog() == DialogResult.OK)
{
try
{
image.Save(savedlg.FileName, aif[savedlg.FilterIndex - 1]);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Text);
return;
}
strFileName = savedlg.FileName;
Text = strProgName + " - " + Path.GetFileName(strFileName);
}
}
}
Pages 1112 and 1113: Correction to MetafileConvert.cs Code
On pages 1112 and 1113, replace the MetafileConvert.cs code with
the following:
//----------------------------------------------
// MetafileConvert.cs (c) 2001 by Charles Petzold
//----------------------------------------------
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO; // For Path class
using System.Windows.Forms;
class MetafileConvert: MetafileViewer
{
public new static void Main()
{
Application.Run(new MetafileConvert());
}
public MetafileConvert()
{
Text = strProgName = "Metafile Convert";
}
protected override void MenuFileSaveAsOnClick(object obj, EventArgs ea)
{
SaveFileDialog dlg = new SaveFileDialog();
if (strFileName != null && strFileName.Length > 0)
dlg.InitialDirectory = Path.GetDirectoryName(strFileName);
dlg.FileName = Path.GetFileNameWithoutExtension(strFileName);
dlg.AddExtension = true;
dlg.Filter = "Windows Bitmap (*.bmp)|*.bmp|" +
"Graphics Interchange Format (*.gif)|*.gif|" +
"JPEG File Interchange Format (*.jpg)|" +
"*.jpg;*.jpeg;*.jfif|" +
"Portable Network Graphics (*.png)|*.png|" +
"Tagged Image File Format (*.tif)|*.tif;*.tiff";
ImageFormat[] aif = { ImageFormat.Bmp, ImageFormat.Gif,
ImageFormat.Jpeg, ImageFormat.Png,
ImageFormat.Tiff };
if (dlg.ShowDialog() == DialogResult.OK)
{
Bitmap bm = MetafileToBitmap(mf);
try
{
bm.Save(dlg.FileName, aif[dlg.FilterIndex - 1]);
// bm.Save(dlg.FileName);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Text);
}
}
}
Bitmap MetafileToBitmap(Metafile mf)
{
Graphics grfx = CreateGraphics();
int cx = (int) (grfx.DpiX * mf.Width / mf.HorizontalResolution);
int cy = (int) (grfx.DpiY * mf.Height / mf.VerticalResolution);
Bitmap bm = new Bitmap(cx, cy, grfx);
grfx.Dispose();
grfx = Graphics.FromImage(bm);
grfx.DrawImage(mf, 0, 0, cx, cy);
grfx.Dispose();
return bm;
}
}
Page 1118: Filename Is Stored As String
There is an incorrect statement at the bottom of page
1118.
Change:
"Instead, the filename is stored as a file and
the..."
To:
"Instead, the filename is stored as a string and
the..."
Microsoft Press is committed to providing informative and accurate
books. All comments and corrections listed above are ready for inclusion in
future printings of this book. If you have a later printing of this book, it
may already contain most or all of the above
corrections.