天天看點

10月9日至10月22日備忘錄

1, Dictionary的用法:Add(), ContainsKey();value為一個數組;value為一個類;參見:www.cnblogs.com/linlf03/archive/2011/12/09/2282574.html

2,DataGridView及其子控件(Column),具備換行的屬性(column.DefaultCellStyle.WrapMode=DataGridVierTriState.True)

3,更新控件字号的方法,重新設定改字型及其大小。dataGridView.Font=new Font(dataGridView.Font.FontFamily, 10)

4,在多個條件(事件觸發行為Ctrl+"+"和Ctrl"OmePlus")進行判斷時,将行為一緻的放在一起。

5,DataGridView清單項自适應調整事件(AutoResizeColumn(columnIndex)),ColumnWidthChanged事件觸發時,可以在這個地方重設其寬度或其他屬性。

6,Screen控件的使用,結合Rectangle、Point,用來設定(調整)控件的顯示位置:

    Rectangle rectange=new Rectangle();

    foreach(Screen screen in Screen.AllScreens)

    {

      screenBound=Rectangle.Union(screenBound, screen.Bounds);

    }

    if(this.Right>screentBounds.Right)

      this.Location= new Point(this.Location.X-(this.Right-screenBounds.Right),this.Location.Y);

7,Linq中的泛型資料查詢。例,擷取朋友圈中愛好為籃球的老鄉序列:var friends=new List<Friend>(); var hobbies= friends.Where(i=>i.Hometown=="Beijing").Select(i=>i.Hobbies="BasketBall");

8,注意設計之道:MVP的典型行為是:UI觸發->傳給Presenter處理->資料處理->更新UI。

9,注意父類和子類的方法使用,若存在相同僚件行為,可自定義私有函數實作繼承重寫。Protected virtual DoSomething();  portected override void DoSomething();

10,注意視窗控件的預設語言設定,在窗體設為預設即可(SimSun, Segoe的差別)。

墨匠

繼續閱讀