Three-dimensional hard-pressed code workers

Source: Internet
Author: User

I just resigned from Suzhou in March 18 this year and rushed to the next company without a stop. I knew that I had been in that company for only 26 days. I had to resign for various reasons, at the end of his resignation, there was still a major problem.

This was the first time I came to Shanghai. It gave me a sense of hate for this place in Shanghai, but my life is still going on and I have to find a new job, of course, a hard-pressed life begins.

Why is the beginning of a hard-pressed life! Because the number of companies that recruit WPF is very small (in fact, I still did not learn well, I am too keen to learn well), most of them are web development.

After two years of development, although most of them are engaged in winform development, they have not worked hard enough to devote their spare time to other technologies.

No way. It is difficult to find a job, and the interview is more difficult.

Each interview is broken. Of course, there are few interview opportunities. I am suffering from the interview company and me!

Of course, during the interview with WPF, I felt that most companies would take multi-threaded operations on the computer, Drag and Drop controls, zoom in, zoom out, delete them, and search for the number of controls within a fixed range.

The code for implementing these functions is as follows.

The first one is WPF. dynamically add, delete, zoom in, and narrow controls on the interface to find the number of controls within a fixed range (of course, the program may be a little bug, you can change and refactor it yourself ).

1. How to add controls on the WPF page?

Container: canvas (Positioning Control coordinates)

Controls: custom controls or user controls. In fact, I personally prefer user controls for convenience and a small amount of code. Of course, custom controls have better scalability.

How to add: Click to get the coordinates of the mouse in the canvas, assign a value to the created control object, and then add the control to the canvas.

2. How do I click Delete control?

How to delete: Click the control, trigger the control Click Event, and delete the control from the canvas.

3. How do I drag controls on the interface?

In fact, when I first started to do this, I first thought about whether there was a canvas supporting the drag-and-drop controls, but the technology was limited and I had no idea how to do it. I had to learn from others' code.

Code from http://www.codeproject.com/Articles/15354/Dragging-Elements-in-a-Canvas

Of course, you can also define a drag-and-drop control. For specific code, refer:Http://www.codeproject.com/Articles/71792/WPF-Draggable-Label

I am very poor at English. I am glad to know the code in it. This is also a tragedy... I will only look at the child paper of the code...

Canvas that can drag and drop controls in a canvas: (1) it must have an object to store drag and drop controls. Of course, all WPF controls inherit from uielement (you can refer to msdn)

(2) other objects: coordinates of the mouse to start dragging, horizontal and vertical offset of the control, number of changes to the cursor After dragging, and whether the control is being dragged

(3) additional attributes: whether the container can be dragged, whether it can be moved, and whether the range of the specified parent container can be moved.

(4) method: Search controls (visual tree and logic tree search), rewrite the method, drag and drop the control three methods, press the mouse, move the mouse, and release the mouse.

4. How do I scale a widget?

To be honest, I can't do this. I have to learn from other people's ideas. Of course, this buddy's name is also very unique. The garden, hey, or the blog garden's child paper.

This is his blog garden address: http://www.cnblogs.com/mgen/archive/2011/06/07/2074675.html

Big brother, I have borrowed your code. Thank you for sharing it.

5. How can I find the number of controls within the specified range?

Drag and Drop the mouse to draw a dotted box. Well, I admit that I am a very bad code engineer and I am too lazy to do this.

Du Niang: C # Draw a dotted box with the mouse

I copied the code to my code at another speed, and changed the key part, OK, project running, and everything except some bugs.

Implementation Method: I used a dictionary to store all controls (including control coordinates and sizes) in the canvas, and finally calculated the coordinates of the dotted box of the mouse, as well as the size, and traversed the dictionary, calculate the number.

Of course, I have always been skeptical about this practice. It is not very fast, not the best.

---------------------------------------------------------------- Split line -------------------------------------------------------------------------

I am a little simple about the second WPF thing. Sorry, I am not very familiar with multithreading. I have consulted the kids shoes in the group. Here I have to thank Xia yuntong shoes.

In fact, the second thing is very rare, that is, draw a circle on the interface, you can drag, then add two lable and a button on the interface, click the button, generate two random numbers

Then it is displayed on the two lable. Compare the two random numbers with different sizes, and the circle color is different. The value of lable is not refreshed every other second.

1. The drag-and-drop control is also based on the above. There is a canvas that supports drag-and-drop.

2. The multi-thread control interface is updated. Click the mouse to start two threads and set them as background threads. Each thread generates a random number and then compares the random number to change the circle color.

 

This is the first link address (copy the link to the address bar to download)

Http://files.cnblogs.com/xuliangjie/Drawing.rar

Second link address

Http://files.cnblogs.com/xuliangjie/WpfApplication.rar

 

------------------------------------------------------------- Split line -----------------------------------------------------------------------------------

Recent interviews are web development, hard to force ah, today I have no intention to see the http://www.w3cfuns.com

In this http://www.w3cfuns.com/topic-43.html? Service = pact Interface

If you click a certain item, there will be a lot of content on the right side, but if you drag the scroll bar on the right, the navigation information on the left will disappear, and it will feel unfriendly for a moment, you must always be in front of me in the left navigation bar,

It won't work even if it takes a while.

The following is a picture. You may have a solution.

 

Isn't this a user experience?

It's been so long before you take a rest, everybody. Good night.

 

 

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.