C# Halcon 图像放大缩小代码
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                C# Halcon 图像放大缩小代码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                ?
private void hWindowControl1_HMouseWheel(object sender, HalconDotNet.HMouseEventArgs e){if (ho_img != null){try{//獲取鼠標位置hwin1.GetMpositionSubPix(out mposition_row, out mposition_col, out button_state);//獲取顯示控件像素位置hwin1.GetPart(out current_beginRow1, out current_beginCol1, out current_endRow1, out current_endCol1);//獲取顯示像素大小Ht = current_endRow1 - current_beginRow1;Wt = current_endCol1 - current_beginCol1;}catch (HalconException){}if (e.Delta > 0) // 放大圖像{if (Ht > 4){zoom_beginRow1 = (int)(current_beginRow1 + (mposition_row - current_beginRow1) * 0.300d);zoom_beginCol1 = (int)(current_beginCol1 + (mposition_col - current_beginCol1) * 0.300d);zoom_endRow1 = (int)(current_endRow1 - (current_endRow1 - mposition_row) * 0.300d);zoom_endCol1 = (int)(current_endCol1 - (current_endCol1 - mposition_col) * 0.300d);hwin1.SetPart(zoom_beginRow1, zoom_beginCol1, zoom_endRow1, zoom_endCol1);hwin1.ClearWindow();try{HSystem.SetSystem("flush_graphic", "true");if (cbxImage.Text != ""&& Image.Count>0)DispImage(Image[cbxImage.Text], true);elsehwin1.DispObj(ho_img);OnHMouseWheelEvent();if (中心ToolStripMenuItem.Checked)disp_win_cross(ho_img);HSystem.SetSystem("flush_graphic", "false");}catch (HalconException){}}}else // 縮小圖像{if (Ht < 8000){zoom_beginRow1 = (int)(mposition_row - (mposition_row - current_beginRow1) / 0.700d);zoom_beginCol1 = (int)(mposition_col - (mposition_col - current_beginCol1) / 0.700d);zoom_endRow1 = (int)(mposition_row + (current_endRow1 - mposition_row) / 0.700d);zoom_endCol1 = (int)(mposition_col + (current_endCol1 - mposition_col) / 0.700d);hwin1.SetPart(zoom_beginRow1, zoom_beginCol1, zoom_endRow1, zoom_endCol1);hwin1.ClearWindow();try{HSystem.SetSystem("flush_graphic", "true");hwin1.DispObj(ho_img);if (中心ToolStripMenuItem.Checked)disp_win_cross(ho_img);HSystem.SetSystem("flush_graphic", "false");OnHMouseWheelEvent();}catch (HalconException){}}}}}?
總結
以上是生活随笔為你收集整理的C# Halcon 图像放大缩小代码的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 可怜的TMac
- 下一篇: Windows7 DELLVostro3
