Working with Pictures

Working with Pictures

Description of working with pictures for the Tablet PC.

This topic describes how to adjust pictures using the SizeMode Leave Site property, and how to display pictures in Microsoft® Visual Studio® .NET and Microsoft Visual Basic® 6.0.

The SizeMode Property

You can specify how an image fits in the control with the SizeMode Leave Site property. The SizeMode Leave Site property is available in both the Managed Library and in the Automation Library. With SizeMode Leave Site you can:

  • Re-size the control borders to fit an image.
  • Stretch an image to fit the control borders.
  • Center an image within the control borders.
  • Anchor an image to the upper left of the control without resizing the image or control (in which case some of the image may not be viewable).

Working with Pictures in Visual Studio .NET

To display an image at design time in Visual Studio .NET

  1. Draw an InkPicture control on a form, or double-click the InkPicture control in the Toolbox.
  2. In the Properties window, select the Image property, then click the ellipsis button to open the Open dialog box.
  3. If you are looking for a specific file type (for example, .jpg files), select it in the Files of type box.
  4. Select the file you want to display.

To clear the picture at design time

  1. In the Properties window, select the Image property and right-click the thumbnail image.
  2. Choose Reset.

The InkPicture control is displayed by default without any borders. You can provide a standard or three-dimensional border using the BorderStyle Leave Site property to distinguish the InkPicture box from the rest of the form, even if it contains no image.

You can display an image at run time with the Image Leave Site object's FromFile Leave Site method:

    ctlInkPicture.Image = Image.FromFile("c:\myImageFile")

You can also include a background image with the BackgroundImage Leave Site property; however, it cannot be resized.

Working with Pictures in Visual Basic 6.0

To display an image at design time in Visual Basic 6.0

  1. Draw an InkPicture control on a form, or double-click the InkPicture control in the Toolbox.
  2. In the Properties window, select the Picture property, then click the ellipsis button to open the Open dialog box.
  3. If you are looking for a specific file type (for example, .jpg files), select it in the Files of type box.
  4. Select the file you want to display.

To clear the picture at design time

  1. In the Properties window, select the Picture property.
  2. Position the cursor in the right hand column, and press Delete.

You can display an image at run time with the LoadPicture method:

    ctlInkPicture.Picture = LoadPicture("c:\myImageFile")