Personal code library Objective C # desktop lyrics (functional simulation)

Source: Internet
Author: User
Using system. drawing; using system. windows. forms; using system. drawing. drawing2d; namespace windowsformsapplication2 {public partial class form1: FORM {public form1 () {initializecomponent (); this. doublebuffered = true; // enable dual-Cache for smoother display. This. size = systeminformation. workingarea. size; // The entire desktop size is used by default. In this way, all text is displayed!} Point mouse_offset; private void form_mousedown (Object sender, mouseeventargs e) {mouse_offset = E. location; // assign the coordinates of the current mouse relative to the upper left corner of the form to mouse_offset} private void form_mousemove (Object sender, mouseeventargs e) {If (E. button = mousebuttons. left) {left = control. mouseposition. x-mouse_offset.x; Top = control. mouseposition. y-mouse_offset.y;} string strtext2show = "Who else is it? "; Private void form1_paint (Object sender, painteventargs e) {graphicspath buttonpath = new graphicspath (); system. drawing. rectangle newrectangle = This. clientrectangle; string stringtext = strtext2show; // the string to be displayed. Fontfamily family = new fontfamily ("Arial"); // modify the font. Int fontstyle = (INT) fontstyle. Regular; // font-shaped, eg: bold or skewed? Int emsize = 72; // font size point origin = new point (0,700-72); // display position. Stringformat format = stringformat. genericdefault; // text layout information // use "string" to display. Buttonpath. addstring (stringtext, family, fontstyle, emsize, origin, format); this. region = new system. drawing. region (buttonpath); this. backcolor = color. red;} private void form1_click (Object sender, system. eventargs e) {strtext2show = "this is the changed text! "; This. Refresh ();}}}

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.