Tuesday, January 06, 2009
Home
.Net
Return of the Repeater
Complete image control & app
Part 2 - Starting the control
Part 3 - Loading images
Part 4 - Custom exceptions
Part 5 - Fax/Multipage tifs
Part 6 - Custom events
Part 7 - Selecting fax pages
Part 8 - Rotating displays
Part 9 - The power of GDI+
Part 10 - Zooming
Part 11 - .Net's fatal exception
Part 12 - Fix the squishies
Part 13 - Zoom to fit
Part 14 - You beat the pros
Part 15 - Cropping
Part 16 - Bonus: StickyMouse
Part 17 - Finishing touches?
Part 18 - Make the application
Part 19 - Adding viewports
Part 20 - A better toolbar
Part 21 - Connect the toolbar
Part 22 - Adding ImageEditors
Part 23 - Toolbar ZoomCombo
Part 24 - VB3 style ease
Part 25 - Saving images to files
Part 26 - Integer-only textBox
Part 27 - Passing save settings
Part 28 - The last exception
Part 29 - Menus offer more
Part 30 - Book, app & source
Couple of CS Snippets
XML processing quickies
File extension extensions
McAfee.Not
cs IntBox
Floating Holidays
Code snippets
Flexible sorts
Converted deserializations
Autodeploy not found
Autodeploy just stops
VB must be killed
Media file attributes
Fastest file searches
Webservicing custom objects
Aspect correct resize
Funky thumbnails
Wide interval timing
VB2005 or bust?
Recurring events
Single instances
Proper proper casing
Simple address formating
Combo filling reminder
Easy gradient forms
Grrrr on interops?
Winform memory usage
Windows service your ISP
Pretty up VS code printing
Remote configs with no BS
GDI+ printing cd cases
Your own flat combo
Where's the splitter?
Full autoemail
ReessppoonncceeWwrriittee
Kill the back cache
Color to hex
Source to web
Recode without recompile
Prop snippet for VS2008
Database tricks

Your own image control

Originally published December 2002 on DoItIn.net using VB7.0/2002. Updated for VB7.1 February 2005
Links for compiled demo versions, all required resources and source code are included at the end of this article.

Plus, get the complete eBook in Adobe Acrobat 7 format ... all here.


18) Making the application

In your fresh new instance of Visual Studio, pick the Windows Application template to create a new WinForm project. Name the project "ImageTool". Rename "Form1" to "frmMain" and pull it open a bit to give room for two svImageEdit controls.

How big is big enough?

When it comes to imaging applications, the question of default form size is an important one. Unlike a typical database front-end that should easily fit in an unmaximized form, users will need forms big enough to show enough of their images at a realistic zoom to get their jobs done, and typically they'll maximize an imaging application as soon as it starts. Knowing that users will likely try to use as much of their display as possible when running your app, doesn't it make sense to design it for the typical resolution? If so, then what is the "typical resolution"?

I've got a nice viewpoint for this question because my wife works at a retail software company whose main products are very graphics intensive and whose target audience is regular people. The apps that they release, and they've got sales in the millions, all default to full screen. For development planning, her company does and/or buys market research on screen usage and the public information I've seen boils down to this:

  1. In the past couple of years, 640x480 has finally stopped being the most common resolution on end-user PCs
  2. 800x600 which is the typical target for developers even though it has consistently come in third behind 640x480 and 1024x768 for several years is NOT the new #1, 1024x768 is currently the most common end-user screen setting
  3. A significant percentage of machines built by the major vendors in the past year, especially new laptops, don't even support 640x480 on their pre-installed cards
  4. Because of high user demand and lower mass-production costs, LCD screens will soon pass by CRTs as the most common type of bundled display for mid and high pricepoint end-user systems
  5. LCD screens perform best at specific resolution with the current most typical native resolution being 1024x768 for 15inch entry-levels and 1280x1024 for mid and high point 17 and 19inch units
  6. Users tend to stick with the default resolution because they don't know how to change it or, in the case of LCDs, because they find the interpolations of lower resolutions unsatisfying.

Sounds logical. And yet, I know, it's so hard to get companies to believe it and default even an imaging app that could use the room to 1024x768. Go figure. Well, here's hoping those numbers might help get some older IT departments to move out of the silly 640x480 mentality.

For this demonstration, simply because I need to make screenshots for web and print I'll default to an unrealistically small 600x400 and you should make yours fit real end-user screen dimensions.

Toolboxing the control

Right click on the toolbox and select "Add Tab", in the new blank tab type "Custom Controls" and press Enter. Click on the new Custom Controls tab to slide it open, then right click on the new tab's area and select "Add Remove Items". When the "Customize Toolbox" dialog appears, verify that the ".Net Framework Components" tab is selected and press the "Browse" button (lower right of the dialog). Navigate to the compiled release version of the svImageEdit.dll file, select/highlight the file and click on "Open". Verify that the file has indeed been added to the components list.

Click on OK to close the dialog and verify that the control has been added to the toolbox. You can add an instance to your form to check things are ok but if you do delete it before moving on, we have to do other stuff first.

Setting the stage

Control sizing is important in this kind of app and because we know that eventually we'll have menus it's best to get one on the form straight off at least as a placeholder. Add a MainMenu to the form, rename it "mnuMain" and click on its visual builder to add a traditional "&File" item and using the property sheet rename this to "mnuFile".

That's enough to keep the menubar visible. As long as we're right there, go ahead and add a subitem for loading images and closing the app (Name="mniFile_Load" Text="&Load picture" and Name="mniFile_Exit" Text="E&xit"). Double click on the Exit item and add the Me.Close to its click event, we'll do the load stub in a minute.

Next: Adding the viewports

Robert Smith
Kirkland, WA

 

added to smithvoice march 2005


Print  

pagecomment
  Add Comment



Submit Comment
  View Ratings
50.00%0
40.00%0
30.00%0
20.00%0
10.00%0

Number of Comments 0 , Average of Ratings
  View Comments
No comment.


Privacy Statement  |  Terms Of Use
Copyright 2008 by Robert C. Smith