コンポーネント



IPアドレス入力

コモンコントロール(SysIPAddress32)を使用する。
入力された内容は、Textプロパティで取得できる。
public class IpAddressText : TextBox
{
    protected override System.Windows.Forms.CreateParams CreateParams
    {
        get
        {
            System.Windows.Forms.CreateParams createParams = base.CreateParams;
            createParams.ClassName = "SysIPAddress32";
            return createParams;
        }
    }
    protected override bool IsInputKey(Keys keyData)
    {
       switch (keyData)
       {
        case Keys.Down:
            break;
        case Keys.Right:
            break;
        case Keys.Up:
            break;
        case Keys.Left:
            break;
        default:
            return base.IsInputKey(keyData);
        }
        return true;
    }
}

コモンコントロール

Button

  • プログラムでボタンをクリックする(クリックをエミュレートする)
 Button1.PerformClick(); // ボタンのクリックイベントを発生させる。

CheckBox

CheckedListBox

ComboBox

DateTimePicker

Label

LinkLabel

ListBox

ListView

MaskedTextBox

MonthCalender

NotifyIcon

NumericUpDown

PictureBox

ProgressBar

RadioButton

RichTextBox

TextBox

  • エンターキーでフォーカスを外す
Validatingなどと合わせて使いましょう。
private void textBox1_KeyDown(object sender, KeyEventArgs e) {
    if (e.KeyCode == Keys.Enter) {
        this.SelectNextControl(
            this.ActiveControl,
            (e.Modifiers!= Keys.Shift), true, true, true);
        e.Handled = true;
    }
}

ToolTip

TreeView

WebBrowser


コンテナ

FlowLayoutPanel

GroupBox

Panel

SplitContainer

TabControl

TableLayoutPanel


メニューとツールバー

ContextMenuStrip

MenuStrip

StatusStrip

ToolStrip

ToolStripContainer


データ

DataSet

DataGridView

BindingSource

BindingNavigator


コンポーネント

BackgroundWorker

DirectoryEntry

DirectorySearcher

ErrorProvider

EventLog

FileSystemWatcher

HelpPrivider

ImageList

MessageQueue

PerformanceCounter

Process

SerialPort

ServiceController

Timer


印刷

PageSetupDialog

PrintDialog

PrintDocument

PrintPreviewControl

PrintPreviewDialog


ダイアログ

ColorDialog

FolderBrowserDialog

FontDialog

OpenFileDialog

SaveFileDialog

最終更新:2009年08月03日 13:20