コード例 #1
0
        /// <summary>
        /// 显示按钮按下处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            //此处需要判断文本框中是不是输入的纯整型数字

            Rectangle pRectangle = new Rectangle((int)nudLeft.Value, (int)nudTop.Value, (int)(nudRight.Value - nudLeft.Value), (int)(nudBottom.Value - nudTop.Value));
            IntPtr    pBoxInfo   = IntPtr.Zero;

            pBoxInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Rectangle)));//分配固定的指定大小的内存空间
            if (pBoxInfo != IntPtr.Zero)
            {
                Marshal.StructureToPtr(pRectangle, pBoxInfo, true);
            }
            DHPlay.DHSetDisplayRegion(DisplayRegionPort, RegionSN, pBoxInfo, this.picDisplayMain.Handle, true);
        }
コード例 #2
0
 /// <summary>
 /// 关闭窗口的处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmDisplayRegion_FormClosing(object sender, FormClosingEventArgs e)
 {
     //此操作不做下次打开画面时会有问题,不做此操作不能正确显示
     DHPlay.DHSetDisplayRegion(DisplayRegionPort, RegionSN, IntPtr.Zero, this.picDisplayMain.Handle, false);
 }