c datagrid的每行的單擊事件

2022-07-19 09:15:13 字數 1827 閱讀 7075

需要乙個幫助類

using

system;

using

system.net;

using

system.windows;

using

system.windows.controls;

using

system.windows.documents;

using

system.windows.ink;

using

system.windows.input;

using

system.windows.media;

using

system.windows.media.animation;

using

system.windows.shapes;

using

system.threading;

namespace

common

public control control

public

int timeout

public mouseclickmanager(control control, int

timeout)

public

void handleclick(object

sender, mousebuttoneventargs e)

else}}

private

void resetthread(object

state)}}

private

void onclick(object

sender, mousebuttoneventargs e)

private

void ondoubleclick(object

sender, mousebuttoneventargs e)}}

view code

"

0" autogeneratecolumns="

false

" selectionmode="

single

" isreadonly="

true

" x:name="

datagrid

" loadingrow="

datagrid_loadingrow

" />

private

readonly mouseclickmanager _gridclickmanager; //

宣告,需要引入上面定義的類

this._gridclickmanager = new mouseclickmanager(this.datagrid,300);//

例項化,並指向需要控制的空間名稱(this.datagrid).放在建構函式中

this._gridclickmanager.doubleclick += new system.windows.input.mousebuttoneventhandler(_gridclickmanager_doubleclick);//

委託雙擊事件.放在建構函式中

void _gridclickmanager_doubleclick(object sender, system.windows.input.mousebuttoneventargs e) //

雙擊事件的實現

private

void datagrid_loadingrow(object sender, datagridroweventargs e) //

給表中的每一行載入雙擊事件

設定MSHFlexGrid每行的顏色

設定mshflexgrid每行的顏色 public sub setrowcolor byref mshflexgrid as object dim j,i,objname objname typename mshflexgrid if strconv trim objname vbuppercase...

簡單的讀取檔案的每行內容

最近在做音訊處理的東西,分類svm後得到如下的檔案 1.11 的這樣乙個檔案,每行只有 1或1,現為統計分類器的準確性,需要統計出1和 1的個數 程式開始如下 include include include int main else while fgets buf,10,fp null print...

設定button的單擊響應事件

1 實現onclicklistener介面 public class preferences extends activity implements button.onclicklistener public void onclick view v 2 通過xml檔案指定 public class ...