C # trivial matters

Source: Internet
Author: User
1 button2.w.mclick (); this method simulates a button2 click event.
2. If there is an item, do not add it.

When no entry is added in ComboBox. Remember this idea

if (createEngineTypeCombox.Items.Count == 0)
{
    createEngineTypeCombox.Items.Add(m_engineType[1]);
    createEngineTypeCombox.Items.Add(m_engineType[2]);
    createEngineTypeCombox.Items.Add(m_engineType[3]);
    createEngineTypeCombox.Items.Add(m_engineType[4]);
    createEngineTypeCombox.Items.Add(m_engineType[5]);
    createEngineTypeCombox.Items.Add(m_engineType[6]);
    createEngineTypeCombox.SelectedIndex = 0;
}3How to center and dock the winform button at the bottom
 

Set the anchor of the control (button) to bottom, and place the control (button) in the middle, no matter how the form is dragged or maximized, its position is always centered at the bottom.

For example, set:

Winform changes the border color of the button:

The property above flatstyle: flatappearance can be the border style of the button.

 

If (E. Button = 4) // 4 indicates the middle mouse button

{

Axsupermap. Action = seaction. scapan;

}

Mouse button:

1 left button
2 right button
3 left and right buttons
4 middle button
5 left and middle buttons
6 Right and middle buttons
7 all buttons

 

C # Time required to test the running of a code segment

Using system. diagnostics;

Stopwatchwatch = new stopwatch ();

Watch. Start ();

// Code to be tested

Watch. Stop ();

Longwatchtime = watch. elapsedmilliseconds; // time spent

Result = system. environment. newline.

 

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.