Asp. NET development experience (2)---ASP. Some graphics processing in net

Source: Internet
Author: User
Asp.net| Graphics If you have used SharePoint Portal Server 2001, you will remember that some of the more interesting features in the added folder, such as document Checkout/check-in, publishing, approval process, and so on, the most appealing to me is that it adds a special tag to the document's icon To represent the status of the document, as shown in the following illustration:


In doing the document management system, also borrowed this approach, in fact, and to the image of the method of watermarking similar, the main code is as follows:


Source image
Image Imgphoto = Image.FromFile (ssourcefile);
Bitmap Bmphoto = new Bitmap (Imgphoto.width, Imgphoto.height, Pixelformat.format24bpprgb);
Bmphoto.maketransparent ();
Set drawing surface properties, rendering quality, etc.
Graphics Grphoto = Graphics.fromimage (Bmphoto);
Grphoto.smoothingmode = Smoothingmode.antialias;
Grphoto.drawimage (Imgphoto, New Rectangle (0, 0, Imgphoto.width, imgphoto.height), 0, 0, imgphoto.width, Mgphoto.height, GraphicsUnit.Pixel);


Open the watermark picture you want to attach
Image Imgwatermark = new Bitmap (swatermarkfile);
Bitmap Bmwatermark = new Bitmap (Bmphoto);
Bmwatermark.setresolution (Imgphoto.horizontalresolution, imgphoto.verticalresolution);
Graphics Grwatermark = Graphics.fromimage (Bmwatermark);

int XPOSOFWM = Imgphoto.width-imgwatermark.width;
int YPOSOFWM = Imgphoto.height-imgwatermark.height;

Draw
Grwatermark.drawimage (Imgwatermark,
New Rectangle (Xposofwm,yposofwm,imgwatermark.width,imgwatermark.height),
0,
0,
Imgwatermark.width,
Imgwatermark.height,
GraphicsUnit.Pixel);

Save the final picture
Imgphoto = Bmwatermark;
Imgphoto.save (siconfilename,imageformat.png);



If the document has a review process, the flow chart of the document is very popular so that users can easily see the document at that stage.
In fact, with the workflow related software may have such requirements, I currently do not find a better way to use <table>, will be all stages
With lines and graphics, the method is a bit stupid, but it seems to show the effect is good.



Have tried VML, found that to dynamically draw this diagram, you have to very precise control of the location on the screen, more trouble, and then abandoned this practice.

I also tried to use Visio Automation to try and find that Visio's object model and VBA are much harder and more work-intensive than Word and Excel.




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.