freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

[計算機軟件及應用]arcgisengine10開發(fā)手冊word版-資料下載頁

2025-04-14 05:29本頁面
  

【正文】 設置為我們用鼠標點擊的工具,然后伙伴控 件就等著和我們的工具交互。 工具控件,這通常是用戶界面組件,如 ToolBarControl 控件上的列表框和組合框。 其實在 ToolBarControl 控件中還可以宿主工具條菜單(ToolbarMenu),工具條菜單表示單擊 命令項的一個垂直列表。用戶必須選擇工具條菜單上的一個命令項,或單擊工具條菜單之外 的地方使其消失。工具條菜單只能駐留命令項(不允許駐留工具或者工具控件) 命令和工具 在 ArcGIS Engine 中,命令是實現了 ICommand 接口,在 ArcGIS Engin 的開發(fā)幫助中,我們可 以看到 ICommand 接口以下成員: 當用戶單擊這個命令時會導致 方法被調用 ,并執(zhí)行某種操作。 要將一個命令宿主到 ToolBarControl 控件上 ,有以下三種方法: 1. 使用 UID 2. 使用 progID 3. 使用 ICommand UID pUID = new UIDClass()。 = 。 (pUID, 1, 0, false, 1, )。 (, 0, 1, true, 0, )。 ICommand pUndo = new ControlsUndoCommandClass()。 (pUndo, 0, 1, false, 0, )。 ICommand 接口是可以被擴展的 ,也就是說這個接口對我們是開放的,只要我們將 ICommand 接口中成員實現,因為這個格式是固定的,Esri 提供了相應的模板 我們知道宿主在 ToolBarControl 上的命令操作的對象是 ToolBarControl 的伙伴控件 ,但 是 ,這個命令怎么和這個伙伴控件聯系起來了 ,注意到 ICommand 接口中有一個 方法 ,這個方法有一個參數 hook。 [C ] p ub lic void On Cre at e (object hook) 。 這個 hook 是一個 object 對象 。也就是說這兒命令和那個控件協(xié)作 ,要看這個 hook 傳入的 是那種控件 。 當命令對象宿主到 ToolBarControl 控件上后就會立即調用 方法,同時會 將 ToolBarControl 控件傳遞給 hook 這個參數,以便命令能和 ToolBarControl 控件的伙伴控件 協(xié)作。一般要在這個方法里面要測試這個 hook 是不是有效,也就是說這個命能不能和這個 hook 協(xié)作,要看這個命令支不支持這樣的操作,比如說我們要打開一個地圖文檔,我們知 道打開地圖文檔這個命令是可以和 MapControl,PageLayoutControl 控件協(xié)作的,如果我們傳 進去的是 TOCContro 控件,那么這個命令就會失效,這些話看起來很費解,我們通過一個代 碼來好好體會這些話。 我們自己定義一個打開地圖文檔的命令 利用 Esri 提供的命令模板 選擇和命令對象協(xié)作的控件 using System。 using 。 using 。 using 。 using 。 using 。 using 。 using 。 namespace EngineApplication { /// summary /// Summary description for OpenMxdCommand. /// /summary [Guid(c142fea52e8e4f6895e19cad4a6a290e)] [ClassInterface()] [ProgId()] public sealed class OpenMxdCommand : BaseCommand { region COM Registration Function(s) [ComRegisterFunction()] [ComVisible(false)] static void RegisterFunction(Type registerType) { // Required for ArcGIS Component Category Registrar support ArcGISCategoryRegistration(registerType)。 // // TODO: Add any COM registration code here // } [ComUnregisterFunction()] [ComVisible(false)] static void UnregisterFunction(Type registerType) { // Required for ArcGIS Component Category Registrar support ArcGISCategoryUnregistration(registerType)。 // // TODO: Add any COM unregistration code here // } region ArcGIS Component Category Registrar generated code /// summary /// Required method for ArcGIS Component Category registration /// Do not modify the contents of this method with the code editor. /// /summary private static void ArcGISCategoryRegistration(Type registerType) { string regKey = (HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}, )。 (regKey)。 } /// summary /// Required method for ArcGIS Component Category unregistration /// Do not modify the contents of this method with the code editor. /// /summary private static void ArcGISCategoryUnregistration(Type registerType) { string regKey = (HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}, )。 (regKey)。 } endregion endregion IMapControl2 pMapControl。 public OpenMxdCommand() { // // TODO: Define values for the public properties // = 打開地圖文檔。 //localizable text = 打開地圖文檔。 //localizable text = 打開地圖文檔。 //localizable text = 打開地圖文檔。 //localizable text = 打開地圖文檔。MyCategory_MyCommand)try{////unique id, nonlocalizable (. // TODO: change bitmap name if necessary // string bitmapResourceName = GetType().Name + .bmp。 = new Bitmap(GetType(), bitmapResourceName)。 } catch (Exception ex) { (, Invalid Bitmap)。}} region Overridden Class Methods /// summary /// Occurs when this mand is created /// /summary /// param name=hookInstance of the application/param public override void OnCreate(object hook) { if (hook == null) return。 //在這里對hook進行判斷 if (hook is IToolbarControl) { IToolbarControl pToolBar= hook as IToolbarControl 。 pMapControl = as IMapControl2。 } else if(hook is IMapControl2 ) { pMapControl = hook as IMapControl2。}// TODO: Add other initialization code } /// summary /// Occurs when this mand is clicked /// /summary public override void OnClick() { // TODO: Add implementation //launch a new OpenFile dialog OpenFileDialog pOpenFileDialog = new OpenFileDialog()。 = Map Documents (*.mxd)|*.mxd。 = false。 = Open Map Document。 if (() == ) { string docName = 。 IMapDocument pMapDoc = new MapDocumentClass()。 if ((docName) amp。amp。 !(docName)) { (, null, null)。 // set the first map as the active view ()。 ()。 } }}endregion } } 通過下面兩句將我們自定義的打開地圖文檔的命令宿主到 ToolBarControl 上 OpenMxdCommand pMxdCommand = new OpenMxdCommand()。 (pMxdCommand, 1, 0, false, 1, )。 效果如下: 我們可以對上述代碼添加斷點 ,發(fā)現當程序執(zhí)行到 (pMxdCommand, 1, 0, false, 1, )。的時候,OnCreate 函數被執(zhí)行,進而對 hook 參數判斷,通過進一步跟蹤,發(fā)現程序執(zhí)行到 if (hook is IToolbarControl) { IToolbarControl pToolBar= hook as IToolbarControl 。 pMapControl = as IMapControl2。 } 說明程序將 ToolbarControl 控件傳入進去。 而工具是實現了 Itool 和 ICommand 這兩個接口 ,從 ITool 的接口成員中我們就不難看出 工具和命令的區(qū)別: ITool 接口的成員幾乎都是和交互相關的一些事件. 上述我們都是將命令或者工具宿主到了 ToolBarControl 控件上,能不能脫離 ToolBarControl 控件呢?答 案是可以的。 脫離 ToolBarControl 控件的命令和工具 我們在 Form 中添加 MenueStrip 控件,并添加以下幾個功能,然后分別寫入相應的代碼 private void 文件ToolStripMenuItem_Click(object sender, EventArgs e){ICommand pMxd = new ControlsOpenDocCommandClass()。 ()。 ()。 } private void 查詢ToolStripMenuItem_Click(object sender, EventArgs
點擊復制文檔內容
畢業(yè)設計相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1