編輯 | 究查 | 歷程 | 原始
flowchart TD
    Start([開始 GetSiteOMR]) --> Init[Result = 0]
    Init --> CheckLoad{影像檔名不符且非空?}
    
    CheckLoad -- 是 --> LoadImg[載入影像 ImageScrollBox1.LoadFromFile]
    LoadImg --> ClearBW[初始化黑白緩衝區 ClearLine]
    ClearBW --> Redraw[重繪影像 ISB_BW.Redraw]
    Redraw --> ProcessMsg[處理系統訊息 Application.ProcessMessages]
    ProcessMsg --> CheckFileExist
    
    CheckLoad -- 否 --> CheckFileExist{ImageScrollBox1.FileName 非空?}
    
    CheckFileExist -- 是 --> GetInfo[獲取 DPI 與影像寬高]
    GetInfo --> ConvRect[轉換 Site 字串為 OMRRect 矩陣\nCM_Str2Rect]
    ConvRect --> LogDisp[記錄定位點與矩陣資訊到 Display1]
    
    LogDisp --> BoundaryL{Left < 0?}
    BoundaryL -- 是 --> SetL[Left = 0]
    BoundaryL -- 否 --> BoundaryT{Top < 0?}
    SetL --> BoundaryT
    
    BoundaryT -- 是 --> SetT[Top = 0]
    BoundaryT -- 否 --> BoundaryR{Right > Width?}
    SetT --> BoundaryR
    
    BoundaryR -- 是 --> SetR[Right = Width]
    BoundaryR -- 否 --> BoundaryB{Bottom > Height?}
    SetR --> BoundaryB
    
    BoundaryB -- 是 --> SetB[Bottom = Height]
    BoundaryB -- 否 --> CallOMR
    SetB --> CallOMR
    
    CallOMR[呼叫 Get_OMR 執行辨識] --> SetResult[Result = 辨識結果]
    SetResult --> End([結束])
    
    CheckFileExist -- 否 --> End