{ ============================================================================== 方法名稱:PageLVClick 引用相依: 方法描述:處理影像列表點擊。選取項目後同步更新 ScrollBar1 的位置。 ============================================================================== } procedure TCB_IMGPSScanX.PageLVClick(Sender: TObject); begin IF PageLV.Selected = nil Then Exit; PageLVclear := False; ScrollBar1.Position := PageLV.Selected.Index+1; PageLVclear := True; end; { ============================================================================== 方法名稱:PageLVKeyUp 引用相依: 方法描述:處理影像列表按鍵放開事件。若有選取項目,則同步更新 ScrollBar1 的位置。 ============================================================================== } procedure TCB_IMGPSScanX.PageLVKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin IF PageLV.Selected = nil Then Exit; ScrollBar1.Position := PageLV.Selected.Index+1; end; { ============================================================================== 方法名稱:PageLVMouseDown 引用相依: 方法描述:處理影像列表滑鼠按下事件。若是右鍵,則選取該項目並彈出右鍵選單。 ============================================================================== } procedure TCB_IMGPSScanX.PageLVMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin IF Button = TMouseButton(MbRight) Then begin If PageLV.GetItemAt(X,Y) = nil then Exit; PageLV.Selected := PageLV.GetItemAt(X,Y); PageLVClick(self); PageLV.PopupMenu.Popup(Mouse.CursorPos.X ,Mouse.CursorPos.Y); end; end; { ============================================================================== 方法名稱:AttListBoxClick 引用相依: 方法描述:處理附加檔案列表點擊,若有選取則啟用刪除按鈕。 ============================================================================== } procedure TCB_IMGPSScanX.AttListBoxClick(Sender: TObject); begin DelAttFileLB.Enabled := False; if AttListBox.ItemIndex >= 0 then DelAttFileLB.Enabled := True; end; { ============================================================================== 方法名稱:AttListBoxDblClick 引用相依:FileExists 方法描述:處理附加檔案列表連按兩下,呼叫 ShellExecute 開啟檔案。 ============================================================================== } procedure TCB_IMGPSScanX.AttListBoxDblClick(Sender: TObject); var AttFile : String; begin if AttListBox.ItemIndex < 0 then Exit; AttFile := HTTPEncode(UTF8Encode(AttListBox.Items.Strings[AttListBox.ItemIndex])); if FileExists(DisplayPath+AttFile) then ShellExecute(Application.Handle,'open',PChar(DisplayPath+AttFile),nil,nil,SW_SHOW) else Showmessage(Format(_Msg('找不到檔案:%s'),[AttFile])); end;