Welcome Guest!
 VB Helper
 Previous Message All Messages Next Message 
VB Helper Newsletter  Rod Stephens
 Oct 28, 2011 10:44 PDT 

I had planned to wait until I had more material ready but I wanted to
get this message out right away.

My latest book is available and is on sale for a limited time.

    Start Here! Fundamentals of Microsoft .NET Programming
    http://shop.oreilly.com/product/0790145330536.do

This is without a doubt the strangest book I've written. It's unusual in
at least three ways:

    - It's the first book I've written for Microsoft Press (albeit via
O'Reilly)
    - It's available for free if you buy another "Start Here!" book
(described more in a second)
    - I don't get royalties for copies sold (they paid me a flat fee)

It's intended as a supplement for other beginning programming books,
specifically this one:

    Start Here! Learn Microsoft Visual C# 2010
    By John Paul Mueller
    http://shop.oreilly.com/product/0790145319210.do

The Visual Basic book "Start Here! Learn Microsoft Visual Basic 2010" by
Evangelos Petroutsos is scheduled for publication later.

My book provides background information that makes it easier to learn to
program in C# and Visual Basic .NET. It will help you:

    - Delve into basic object-oriented concepts such as classes and
inheritance
    - Learn how programs store data in memory, in files, and in
databases
    - Understand how control statements help programs work
    - Become familiar with the widgets for building graphical user
interfaces
    - Discover how programs take advantage of multicore processors
    - Use globalization to provide programs for users throughout the
world
    - Get an extensive glossary of key programming terms

The idea is for my book to cover this information in greater depth than
most introductory books have room for so the other "Start Here!" books
don't need to spend as much time on that material.

If you buy John's book (or Evangelos's book when it comes out), you will
receive a coupon that lets you get my book in electronic format for free
(because it's supposed to supplement the other books).

My book still may be useful, however, even if you don't want to buy one
of the other "Start Here!" books, so Microsoft is making it available
separately. You can buy it through O'Reilly
(http://shop.oreilly.com/product/0790145330536.do) or Amazon
om/Start-Fundamentals-Microsoft�-Programming-ebook/dp/B005WL6H86)
in either electronic or print versions. (The print versions cost more.)

Finally, for a limited time, the electronic version is on sale at
O'Reilly's website (http://shop.oreilly.com/product/0790145330536.do)
for $7.99.
-----
Have a great week and thanks for subscribing!

Rod
RodSte-@vb-helper.com

Twitter feeds:
    VBHelper
    CSharpHelper
==========
==========

    VB.NET Contents:
1. New HowTo: Display a Windows metafile (wmf file) in Visual Basic .NET
2. New HowTo: Convert a Windows metafile (wmf file) to a PNG file in
Visual Basic .NET
==========
++++++++++
      <VB.NET>
++++++++++
==========
1. New HowTo: Display a Windows metafile (wmf file) in Visual Basic .NET
http://www.vb-helper.com/howto_net_display_wmf.html
http://www.vb-helper.com/HowTo/howto_net_display_wmf.zip

(Picture at http://www.vb-helper.com/howto_net_display_wmf.png.)

A Windows metafile (wmf file) is an image file that contains
instructions for drawing shapes. In contrast bitmap, PNG, JPG, and other
raster image files indicate exactly what colors individual pixels should
have. Because a metafile contains drawing instructions instead of pixel
values, you can resize a metafile without producing ugly anti-aliasing
effects.

The picture shown here loads the same metafile as a bitmap and as a
metafile and the enlarged slightly. When loaded as a bitmap (on the
left), the enlarged version is blocky and pixellated. When loaded as a
metafile, the result is smooth.

This example uses the following code to load an image as a bitmap and as
a metafile.

' Load the images.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
    ' Load as a bitmap to see how big it is.
    Dim filename As String = "Epitrochoid.wmf"

    picImage.Image = New Bitmap(filename)
    picMetafile.Image = New Metafile(filename)
End Sub

First the program creates a new Bitmap object, passing its constructor
the metafile's name. It then creates a new Metafile object, passing its
constructor the metafile's name.

The program loads the same file twice, just in the first case it loads
the file into a Bitmap.

For some strange reason, if you set a PictureBox's Image property to a
metafile at design time, the program loads it as a Bitmap not as a
Metafile. That means if you make the PictureBox display the image at
other than its original size, you get aliasing effects.

Therefore to get the best result, you should load metafiles at run time
as shown by this example.
==========
2. New HowTo: Convert a Windows metafile (wmf file) to a PNG file in
Visual Basic .NET
http://www.vb-helper.com/howto_net_wmf_to_png.html
http://www.vb-helper.com/HowTo/howto_net_wmf_to_png.zip

(Picture at http://www.vb-helper.com/howto_net_wmf_to_png.png)

A WMF file contains a set of drawing commands that tells a program how
to produce an image. This is very useful and allows you to resize the
image without producing ugly anti-aliasing effects but sometimes you may
want a raster image so you can manipulate its pixels. This example lets
you load WMF files and save them as PNG files.

The program uses the following code to load a WMF file.

' Open a WMF file.
Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuFileOpen.Click
    If (ofdWmfFile.ShowDialog() = DialogResult.OK) Then
        picImage.Image = New Bitmap(ofdWmfFile.FileName)
        mnuFileSaveAs.Enabled = True

        ClientSize = New Size( _
            picImage.Right + picImage.Left, _
            picImage.Bottom + picImage.Left)
    End If
End Sub

The code displays a FileOpenDialog to let the user select the WMF file.
If the user selects a file and clicks Open, the program loads the file
into a Bitmap and displays it.

The program uses the following code to save the loaded image as a PNG
file.

' Save the image as a PNG file.
Private Sub mnuFileSaveAs_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuFileSaveAs.Click
    If (sfdPngFile.ShowDialog() = DialogResult.OK) Then
        Dim bm As Bitmap = DirectCast(picImage.Image, Bitmap)
        bm.Save(sfdPngFile.FileName, ImageFormat.Png)
    End If
End Sub

The program displays a SaveFileDialog to let the user select the file in
which to save the image. It then calls the loaded bitmap's Save method
passing it the file name and the value ImageFormat.Png to indicate that
the image should be saved as a PNG file.

Both WMF and PNG files support transparent pixels. When this program
converts a WMF to a PNG file, any transparent pixels are preserved.
==========
Archives:
    http://www.topica.com/lists/VBHelper
    http://www.topica.com/lists/VB6Helper
    http://www.topica.com/lists/VBNetHelper

Twitter feeds:
    VBHelper
    CSharpHelper

Post questions at:
    http://www.topica.com/lists/VBHelperQA
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.