Lecture 8th: Right-click menu and print function

Source: Internet
Author: User
Tags silverlight visual studio 2010

2010.11.8 su Peng

Content

-Silverlight supports Drop object operations

-Right-click a menu object in Silverlight

-Print in Silverlight

 

Prerequisites

-Install Visual Studio 2010

-Install Expression Blend4

-Install Silverlight tools for Visual Studio 2010

-Understand C #

 

Drop object

-File drag and drop support

-AllowDrop attribute and Drop event

 

Demo

-Example of dragging an image control

Containers do not have to use WrapPanel. Other containers do.

The BitmapImage class supports only jpg and png formats.

E. Data. GetData can take out all FileInfo, including the path and name of the image file.

DroppedFile has a large security permission and does not have full restrictions on the file path. When we drag the file in, droppedFile considers that we allow it to read the file. Next, files can be read using binary streams. Therefore, be careful when developing and using files.

In addition to images, we can also read text.

 

Right-click menu

-MouseRightButtonDown and MouseRightButtonUp Methods

-Popup class

 

Demo

-Right-click menu

When we finish the click event, we need. handled is set to true. If we do not do this, the Silverlight Framework will Handle it. The Silverlight Framework itself has its right-click menu, in this way, the right-click menu is displayed. So in any case, we need to write this sentence to indicate that we will handle this matter.

 

Print function

-PrintDocument object

-Call PrintDocument. Print ()

 

Demo

-Print example

The standard function of Print does not contain parameters. If you call the Print function, you must tell the program to Print the elements in the previous PrintPage, specifies what to print through PrintPage. The parameters in Print are the name of the Print job, which can be viewed in the printer status.

Run the program and click Print. The Print settings will pop up.

Click print to display the Save location

After printing is complete, open the file and we can see the printed result.

 

Summary

-Silverlight supports Drop object operations

-Right-click a menu object in Silverlight

-Print in Silverlight

2010.11.26

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.