示例#1
0
        /// <summary>
        /// Returns a 3-element array describing the tablet's rotation range and resolution capabilities
        /// </summary>
        /// <returns></returns>
        public static WintabAxisArray GetDeviceRotation(out bool rotationSupported_O)
        {
            WintabAxisArray axisArray = new WintabAxisArray();

            rotationSupported_O = false;
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(axisArray);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)EWTIDevicesIndex.DVC_ROTATION, buf);

                // If size == 0, then returns a zeroed struct.
                axisArray           = CMemUtils.MarshalUnmanagedBuf <WintabAxisArray>(buf, size);
                rotationSupported_O = (axisArray.array[0].axResolution != 0 && axisArray.array[1].axResolution != 0);
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetDeviceRotation: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return(axisArray);
        }
示例#2
0
        /// <summary>
        /// Returns a 3-element array describing the tablet's orientation range and resolution capabilities.
        /// </summary>
        /// <returns></returns>
        public static WintabAxisArray GetDeviceOrientation(out bool tiltSupported_O)
        {
            WintabAxisArray axisArray = new WintabAxisArray();

            tiltSupported_O = false;
            IntPtr buf = WMemUtils.AllocUnmanagedBuf(axisArray);

            try {
                int size = (int)WNativeMethods.WTInfo(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)EWTIDevicesIndex.DVC_ORIENTATION, buf);

                // If size == 0, then returns a zeroed struct.
                axisArray       = WMemUtils.MarshalUnmanagedBuf <WintabAxisArray>(buf, size);
                tiltSupported_O = (axisArray.array[0].axResolution != 0 && axisArray.array[1].axResolution != 0);
            } catch (Exception ex) {
                throw new Exception("FAILED GetDeviceOrientation: " + ex.ToString());
            }

            WMemUtils.FreeUnmanagedBuf(buf);

            return(axisArray);
        }
示例#3
0
文件: CWintabInfo.cs 项目: Bgoon/GKit
        /// <summary>
        /// Returns a 3-element array describing the tablet's orientation range and resolution capabilities.
        /// </summary>
        /// <returns></returns>
        public static WintabAxisArray GetDeviceOrientation(out bool tiltSupported_O)
        {
            WintabAxisArray axisArray = new WintabAxisArray();

            tiltSupported_O = false;
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(axisArray);

            try
            {
                int size = (int)CWintabFuncs.WTInfo(
                    (uint)EWTICategoryIndex.WTI_DEVICES,
                    (uint)EWTIDevicesIndex.DVC_ORIENTATION, buf);

                // If size == 0, then returns a zeroed struct.
                axisArray       = CMemUtils.MarshalUnmanagedBuf <WintabAxisArray>(buf, size);
                tiltSupported_O = (axisArray.array[0].axResolution != 0 && axisArray.array[1].axResolution != 0);
            }
            finally
            {
                CMemUtils.FreeUnmanagedBuf(buf);
            }

            return(axisArray);
        }
        /// <summary>
        /// Returns a 3-element array describing the tablet's rotation range and resolution capabilities
        /// </summary>
        /// <returns></returns>
        public static WintabAxisArray GetDeviceRotation(out bool rotationSupported_O)
        {
            WintabAxisArray axisArray = new WintabAxisArray();
            rotationSupported_O = false;
            IntPtr buf = CMemUtils.AllocUnmanagedBuf(axisArray);

            try
            {
                int size = (int)CWintabFuncs.WTInfoA(
                    (uint)EWTICategoryIndex.WTI_DEVICES, 
                    (uint)EWTIDevicesIndex.DVC_ROTATION, buf);

                // If size == 0, then returns a zeroed struct.
                axisArray = CMemUtils.MarshalUnmanagedBuf<WintabAxisArray>(buf, size);
                rotationSupported_O = (axisArray.array[0].axResolution != 0 && axisArray.array[1].axResolution != 0);                
            }
            catch (Exception ex)
            {
                MessageBox.Show("FAILED GetDeviceRotation: " + ex.ToString());
            }

            CMemUtils.FreeUnmanagedBuf(buf);

            return axisArray;
        }