예제 #1
0
        private void Test_GetDefaultDeviceIndex()
        {
            Int32 devIndex = CWintabInfo.GetDefaultDeviceIndex();

            //TODO: throw error/exception
            //TraceMsg("Default device index is: " + devIndex + (devIndex == -1 ? " (virtual device)\n" : "\n"));
        }
예제 #2
0
        private void Do()
        {
            CWintabContext context;

            try
            {
                //Get the table context Process the System Message Only
                context = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_SYSTEM);
                if (context != null)
                {
                    context.Open();
                    while (true)
                    {
                        context.SetOverlapOrder(true);
                        StatueUpdate("SetOverlapOrder Successful!");
                        Thread.Sleep(2000);
                    }
                }
                else
                {
                    StatueUpdate("Get context Faild!");
                }
            }
            catch (Exception)
            {
            }
        }
예제 #3
0
 private void Test_IsWintabAvailable()
 {
     if (!CWintabInfo.IsWintabAvailable())
     {
         throw new Exception("Wintab was not found!\nCheck to see if tablet driver service is running.\n");
     }
 }
예제 #4
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetDeviceInfo()
        {
            //TraceMsg("DeviceInfo: " + CWintabInfo.GetDeviceInfo() + "\n");
            string devInfo = CWintabInfo.GetDeviceInfo();

            TraceMsg("DeviceInfo: " + devInfo + "\n");
        }
예제 #5
0
        ///////////////////////////////////////////////////////////////////////
        private UInt32 Test_GetNumberOfDevices()
        {
            UInt32 numDevices = CWintabInfo.GetNumberOfDevices();

            Console.WriteLine("Number of tablets connected: " + numDevices + "\n");
            return(numDevices);
        }
예제 #6
0
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetDeviceInfo()
        {
            //Console.WriteLine("DeviceInfo: " + CWintabInfo.GetDeviceInfo() + "\n");
            string devInfo = CWintabInfo.GetDeviceInfo();

            Console.WriteLine("DeviceInfo: " + devInfo + "\n");
        }
예제 #7
0
파일: WintabInput.cs 프로젝트: Bgoon/GKit
        private CWintabContext OpenSystemContext(bool ctrlSysCursor = true)
        {
            CWintabContext context = CWintabInfo.GetDefaultSystemContext();

            if (context == null)
            {
                return(null);
            }
            // Set system cursor if caller wants it.
            if (ctrlSysCursor)
            {
                context.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;
            }
            else
            {
                context.Options &= ~(uint)ECTXOptionValues.CXO_SYSTEM;
            }
            context.Name = "BgoonLibrary Tablet Context";

            deviceID = CWintabInfo.GetDefaultDeviceIndex();
            WintabAxis tabletX = CWintabInfo.GetDeviceAxis(deviceID, EAxisDimension.AXIS_X);
            WintabAxis tabletY = CWintabInfo.GetDeviceAxis(deviceID, EAxisDimension.AXIS_Y);

            NativeRect = new GRect(tabletX.axMin, tabletY.axMin, tabletX.axMax, tabletY.axMax);

            context.OutOrgX = context.OutOrgY = 0;
            context.OutExtX = (int)(context.OutExtX * OutputExtFactor);
            context.OutExtY = (int)(context.OutExtY * OutputExtFactor);
            //context.OutOrgX = context.OutOrgY = 0;
            //context.OutExtX = MaxPos.x;
            //context.OutExtY = MaxPos.y;

            //context.OutExtY *= -1;
            return(context.Open() ? context : null);
        }
예제 #8
0
파일: WintabInput.cs 프로젝트: Bgoon/GKit
        private CWintabContext OpenDigitalContext(bool ctrlSysCursor = true)
        {
            CWintabContext context = CWintabInfo.GetDefaultDigitizingContext();

            if (context == null)
            {
                return(null);
            }

            context.Options |= (uint)ECTXOptionValues.CXO_MESSAGES;
            if (ctrlSysCursor)
            {
                context.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;
            }
            context.Name = "BgoonLibrary Tablet Context";

            deviceID = CWintabInfo.GetDefaultDeviceIndex();
            WintabAxis tabletX = CWintabInfo.GetDeviceAxis(deviceID, EAxisDimension.AXIS_X);
            WintabAxis tabletY = CWintabInfo.GetDeviceAxis(deviceID, EAxisDimension.AXIS_Y);

            NativeRect = new GRect(tabletX.axMin, tabletX.axMax, tabletY.axMin, tabletY.axMax);

            context.OutOrgX = context.OutOrgY = 0;
            context.OutExtX = (int)(context.OutExtX * OutputExtFactor);
            context.OutExtY = (int)(context.OutExtY * OutputExtFactor);

            //context.OutExtY *= -1;

            return(context.Open() ? context : null);
        }
예제 #9
0
        private void Test_IsStylusActive()
        {
            bool isStylusActive = CWintabInfo.IsStylusActive();

            if (isStylusActive == false)
            {
                throw new Exception("Stylus is not active!");
            }
        }
예제 #10
0
        ///////////////////////////////////////////////////////////////////////
        private CWintabContext OpenTestSystemContext(
            int width_I = m_TABEXTX, int height_I = m_TABEXTY, bool ctrlSysCursor = true)
        {
            bool           status     = false;
            CWintabContext logContext = null;

            try
            {
                // Get the default system context.
                // Default is to receive data events.
                //logContext = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_MESSAGES);
                logContext = CWintabInfo.GetDefaultSystemContext(ECTXOptionValues.CXO_MESSAGES);

                // Set system cursor if caller wants it.
                if (ctrlSysCursor)
                {
                    logContext.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;
                }

                if (logContext == null)
                {
                    TraceMsg("FAILED to get default digitizing context.\n");
                    return(null);
                }

                // Modify the digitizing region.
                logContext.Name = "WintabDN Event Data Context";

                WintabAxis tabletX = CWintabInfo.GetTabletAxis(EAxisDimension.AXIS_X);
                WintabAxis tabletY = CWintabInfo.GetTabletAxis(EAxisDimension.AXIS_Y);

                logContext.InOrgX = 0;
                logContext.InOrgY = 0;
                logContext.InExtX = tabletX.axMax;
                logContext.InExtY = tabletY.axMax;

                logContext.OutOrgX = (int)SystemParameters.VirtualScreenLeft;
                logContext.OutOrgY = (int)SystemParameters.VirtualScreenTop;
                logContext.OutExtX = (int)SystemParameters.VirtualScreenWidth;

                // In Wintab, the tablet origin is lower left.  Move origin to upper left
                // so that it coincides with screen origin.
                logContext.OutExtY = -(int)SystemParameters.VirtualScreenHeight;


                // Open the context, which will also tell Wintab to send data packets.
                status = logContext.Open();

                TraceMsg("Context Open: " + (status ? "PASSED [ctx=" + logContext.HCtx + "]" : "FAILED") + "\n");
            }
            catch (Exception ex)
            {
                TraceMsg("OpenTestDigitizerContext ERROR: " + ex.ToString());
            }

            return(logContext);
        }
예제 #11
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
        ///////////////////////////////////////////////////////////////////////
        private CWintabContext OpenTestSystemContext(
            int width_I = m_TABEXTX, int height_I = m_TABEXTY, bool ctrlSysCursor = true)
        {
            bool           status     = false;
            CWintabContext logContext = null;

            try
            {
                // Get the default system context.
                // Default is to receive data events.
                //logContext = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_MESSAGES);
                logContext = CWintabInfo.GetDefaultSystemContext(ECTXOptionValues.CXO_MESSAGES);

                // Set system cursor if caller wants it.
                if (ctrlSysCursor)
                {
                    logContext.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;
                }
                else
                {
                    logContext.Options &= ~(uint)ECTXOptionValues.CXO_SYSTEM;
                }

                if (logContext == null)
                {
                    TraceMsg("FAILED to get default digitizing context.\n");
                    return(null);
                }

                // Modify the digitizing region.
                logContext.Name = "WintabDN Event Data Context";

                WintabAxis tabletX = CWintabInfo.GetTabletAxis(EAxisDimension.AXIS_X);
                WintabAxis tabletY = CWintabInfo.GetTabletAxis(EAxisDimension.AXIS_Y);

                logContext.InOrgX = 0;
                logContext.InOrgY = 0;
                logContext.InExtX = tabletX.axMax;
                logContext.InExtY = tabletY.axMax;

                // SetSystemExtents() is (almost) a NO-OP redundant if you opened a system context.
                SetSystemExtents(ref logContext);

                // Open the context, which will also tell Wintab to send data packets.
                status = logContext.Open();

                TraceMsg("Context Open: " + (status ? "PASSED [ctx=" + logContext.HCtx + "]" : "FAILED") + "\n");
            }
            catch (Exception ex)
            {
                TraceMsg("OpenTestDigitizerContext ERROR: " + ex.ToString());
            }

            return(logContext);
        }
예제 #12
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
 ///////////////////////////////////////////////////////////////////////
 private void Test_IsWintabAvailable()
 {
     if (CWintabInfo.IsWintabAvailable())
     {
         TraceMsg("Wintab was found!\n");
     }
     else
     {
         TraceMsg("Wintab was not found!\nCheck to see if tablet driver service is running.\n");
     }
 }
예제 #13
0
 private void Test_IsWintabAvailable()
 {
     if (CWintabInfo.IsWintabAvailable())
     {
         Console.WriteLine("Wintab was found!\n");
     }
     else
     {
         Console.WriteLine("Wintab was not found!\nCheck to see if tablet driver service is running.\n");
     }
 }
예제 #14
0
        ///////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Opens a Wintab default system context
        /// </summary>
        /// <param name="ctrlSysCursor"></param>
        /// <returns></returns>

        private CWintabContext OpenTestSystemContext(bool ctrlSysCursor = true)
        {
            bool           status     = false;
            CWintabContext logContext = null;

            try
            {
                // Get the default system context.
                // Default is to receive data events.
                logContext = CWintabInfo.GetDefaultSystemContext(ECTXOptionValues.CXO_MESSAGES);

                // Set system cursor if caller wants it.
                if (ctrlSysCursor)
                {
                    logContext.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;
                }
                else
                {
                    logContext.Options &= ~(uint)ECTXOptionValues.CXO_SYSTEM;
                }

                if (logContext == null)
                {
                    TraceMsg("FAILED to get default wintab context.\n");
                    return(null);
                }

                // ----------------------------------------------------------------------
                // Modify the tablet extents to set what part of the tablet is used.
                Rectangle newTabletInRect  = new Rectangle();
                Rectangle newTabletOutRect = new Rectangle();

                SetTabletExtents(ref logContext, newTabletInRect, newTabletOutRect);

                // ----------------------------------------------------------------------
                // Modify the system extents to control where cursor is allowed to move on desktop.
                Rectangle newScreenRect = new Rectangle();

                SetSystemExtents(ref logContext, newScreenRect);

                // Open the context, which will also tell Wintab to send data packets.
                status = logContext.Open();

                TraceMsg("Context Open: " + (status ? "PASSED [ctx=" + logContext.HCtx + "]" : "FAILED") + "\n");
            }
            catch (Exception ex)
            {
                TraceMsg("OpenTestDigitizerContext ERROR: " + ex.ToString());
            }

            return(logContext);
        }
예제 #15
0
        ///////////////////////////////////////////////////////////////////////

        private CWintabContext OpenTestDigitizerContext(
            int width_I = 0, int height_I = 0, bool ctrlSysCursor = true)
        {
            bool           status     = false;
            CWintabContext logContext = null;

            try
            {
                // Get the default digitizing context.
                // Default is to receive data events.
                logContext = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_MESSAGES);

                // Set system cursor if caller wants it.
                if (ctrlSysCursor)
                {
                    logContext.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;
                }

                if (logContext == null)
                {
                    TraceMsg("FAILED to get default digitizing context.\n");
                    return(null);
                }

                // Modify the digitizing region.
                logContext.Name = "WintabDN Event Data Context";

                if (width_I != 0 && height_I != 0)
                {
                    // output in a grid of the specified dimensions.
                    logContext.OutOrgX = logContext.OutOrgY = 0;
                    logContext.OutExtX = width_I;
                    logContext.OutExtY = height_I;
                }

                // Open the context, which will also tell Wintab to send data packets.
                status = logContext.Open();

                TraceMsg("Context Open: " + (status ? "PASSED [ctx=" + logContext.HCtx + "]" : "FAILED") + "\n");
            }
            catch (Exception ex)
            {
                TraceMsg("OpenTestDigitizerContext ERROR: " + ex.ToString());
            }

            return(logContext);
        }
예제 #16
0
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetDefaultDigitizingContext()
        {
            CWintabContext context = CWintabInfo.GetDefaultDigitizingContext();

            Console.WriteLine("Default Digitizing Context:\n");
            Console.WriteLine("\tSysOrgX, SysOrgY, SysExtX, SysExtY\t[" +
                              context.SysOrgX + "," + context.SysOrgY + "," +
                              context.SysExtX + "," + context.SysExtY + "]\n");

            Console.WriteLine("\tInOrgX, InOrgY, InExtX, InExtY\t[" +
                              context.InOrgX + "," + context.InOrgY + "," +
                              context.InExtX + "," + context.InExtY + "]\n");

            Console.WriteLine("\tOutOrgX, OutOrgY, OutExtX, OutExt\t[" +
                              context.OutOrgX + "," + context.OutOrgY + "," +
                              context.OutExtX + "," + context.OutExtY + "]\n");
        }
예제 #17
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetDefaultSystemContext()
        {
            CWintabContext context = CWintabInfo.GetDefaultSystemContext();

            TraceMsg("Default System Context:\n");
            TraceMsg("\tSysOrgX, SysOrgY, SysExtX, SysExtY\t[" +
                     context.SysOrgX + "," + context.SysOrgY + "," +
                     context.SysExtX + "," + context.SysExtY + "]\n");

            TraceMsg("\tInOrgX, InOrgY, InExtX, InExtY\t[" +
                     context.InOrgX + "," + context.InOrgY + "," +
                     context.InExtX + "," + context.InExtY + "]\n");

            TraceMsg("\tOutOrgX, OutOrgY, OutExtX, OutExt\t[" +
                     context.OutOrgX + "," + context.OutOrgY + "," +
                     context.OutExtX + "," + context.OutExtY + "]\n");
        }
예제 #18
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetDeviceAxis()
        {
            WintabAxis axis;

            // Get virtual device axis for X, Y and Z.
            axis = CWintabInfo.GetDeviceAxis(-1, EAxisDimension.AXIS_X);

            TraceMsg("Device axis X for virtual device:\n");
            TraceMsg("\taxMin, axMax, axUnits, axResolution: " + axis.axMin + "," + axis.axMax + "," + axis.axUnits + "," + axis.axResolution.ToString() + "\n");

            axis = CWintabInfo.GetDeviceAxis(-1, EAxisDimension.AXIS_Y);
            TraceMsg("Device axis Y for virtual device:\n");
            TraceMsg("\taxMin, axMax, axUnits, axResolution: " + axis.axMin + "," + axis.axMax + "," + axis.axUnits + "," + axis.axResolution.ToString() + "\n");

            axis = CWintabInfo.GetDeviceAxis(-1, EAxisDimension.AXIS_Z);
            TraceMsg("Device axis Z for virtual device:\n");
            TraceMsg("\taxMin, axMax, axUnits, axResolution: " + axis.axMin + "," + axis.axMax + "," + axis.axUnits + "," + axis.axResolution.ToString() + "\n");
        }
예제 #19
0
        ///////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Allows user to change tablet to system mapping.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void MappingButton_Click(object sender, EventArgs e)
        {
            if (m_logContext == null)
            {
                System.Windows.Forms.MessageBox.Show("Oops - You need to run Wintab tests or Scribble before you can use this button.");
                return;
            }

            PenTestApp.MappingForm mappingDlg = new PenTestApp.MappingForm();
            mappingDlg.Init(m_logContext);
            if (DialogResult.OK == mappingDlg.ShowDialog())
            {
                // Close existing context and create a new context with the changed extents.
                CWintabContext temp   = mappingDlg.LogContext;
                Point          inOrg  = new Point(temp.InOrgX, temp.InOrgY);
                Size           inExt  = new Size(temp.InExtX, temp.InExtY);
                Point          outOrg = new Point(temp.OutOrgX, temp.OutOrgY);
                Size           outExt = new Size(temp.OutExtX, temp.OutExtY);
                Point          sysOrg = new Point(temp.SysOrgX, temp.SysOrgY);
                Size           sysExt = new Size(temp.SysExtX, temp.SysExtY);

                CloseCurrentContext();

                m_logContext = CWintabInfo.GetDefaultSystemContext(ECTXOptionValues.CXO_MESSAGES);

                if (m_logContext == null)
                {
                    throw new NullReferenceException("Oops - FAILED to get default system context.\n");
                }

                SetTabletExtents(ref m_logContext, new Rectangle(inOrg, inExt), new Rectangle(outOrg, outExt));
                SetSystemExtents(ref m_logContext, new Rectangle(sysOrg, sysExt));

                if (m_logContext == null)
                {
                    TraceMsg("Test_DataPacketQueueSize: FAILED OpenTestSystemContext - bailing out...\n");
                    return;
                }

                CreateDataObject(m_logContext);

                m_logContext.Open();
            }
        }
예제 #20
0
파일: WintabInput.cs 프로젝트: Bgoon/GKit
        private void UpdateSometime()
        {
            if (!IsRunning)
            {
                return;
            }

            maxNormalPressure  = CWintabInfo.GetMaxPressure(true);
            maxTangentPressure = CWintabInfo.GetMaxPressure(false);
            displaySize        = new Vector2(
                SystemInformation.VirtualScreen.Width,
                SystemInformation.VirtualScreen.Height);
            if (context != null)
            {
                inputRect  = new GRect(context.InOrgX, context.InOrgY, context.InExtX, context.InExtY);
                outputRect = new GRect(context.OutOrgX, context.OutOrgY, context.OutExtX, context.OutExtY);
                systemRect = new GRect(context.SysOrgX, context.SysOrgY, context.SysExtX, context.SysExtY);
            }
        }
예제 #21
0
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetDeviceOrientation()
        {
            bool            tiltSupported = false;
            WintabAxisArray axisArray     = CWintabInfo.GetDeviceOrientation(out tiltSupported);

            Console.WriteLine("Device orientation:\n");
            Console.WriteLine("\ttilt supported for current tablet: " + (tiltSupported ? "YES\n" : "NO\n"));

            if (tiltSupported)
            {
                for (int idx = 0; idx < axisArray.array.Length; idx++)
                {
                    Console.WriteLine("\t[" + idx + "] axMin, axMax, axResolution, axUnits: " +
                                      axisArray.array[idx].axMin + "," +
                                      axisArray.array[idx].axMax + "," +
                                      axisArray.array[idx].axResolution + "," +
                                      axisArray.array[idx].axUnits + "\n");
                }
            }
        }
예제 #22
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetDeviceRotation()
        {
            bool            rotationSupported = false;
            WintabAxisArray axisArray         = CWintabInfo.GetDeviceRotation(out rotationSupported);

            TraceMsg("Device rotation:\n");
            TraceMsg("\trotation supported for current tablet: " + (rotationSupported ? "YES\n" : "NO\n"));

            if (rotationSupported)
            {
                for (int idx = 0; idx < axisArray.array.Length; idx++)
                {
                    TraceMsg("\t[" + idx + "] axMin, axMax, axResolution, axUnits: " +
                             axisArray.array[idx].axMin + "," +
                             axisArray.array[idx].axMax + "," +
                             axisArray.array[idx].axResolution + "," +
                             axisArray.array[idx].axUnits + "\n");
                }
            }
        }
예제 #23
0
        private CWintabContext OpenQueryDigitizerContext(out bool status)
        {
            status = false;
            CWintabContext logContext = null;

            try
            {
                // Get the default digitizing context.
                // Default is to receive data events.
                logContext = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_MESSAGES);

                // Set system cursor
                logContext.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;

                if (logContext == null)
                {
                    return(null);
                }

                // Modify the digitizing region.
                logContext.Name = "WintabDN Event Data Context";

                // output in a 10000 x 10000 grid
                logContext.OutOrgX = logContext.OutOrgY = 0;
                logContext.OutExtX = 10000;
                logContext.OutExtY = 10000;


                // Open the context, which will also tell Wintab to send data packets.
                status = logContext.Open();

                // set IsConnected to the status of the tablet true = tablet ready false = tablet not found / tablet not supported
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(logContext);
        }
        //---------------------------------------------------------------------
        // Prepare to take tablet input
        //---------------------------------------------------------------------
        private void PrepareForTabletInput(object sender, EventArgs e)
        {
            // Set up the tablet context
            CWintabContext context = new CWintabContext();

            context = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_MESSAGES);

            // Allow the mouse to move
            context.Options |= (uint)ECTXOptionValues.CXO_SYSTEM;

            context.Name    = "Tablet event data context";
            context.OutOrgX = 0;
            context.OutOrgY = 0;
            context.OutExtX = 1000;
            context.OutExtY = 1000;

            bool status = context.Open();

            // Prepare to take data
            data = new CWintabData(context);
            data.SetWTPacketEventHandler(TabletEventHandler);
        }
예제 #25
0
        /// <summary>
        /// Tries initializing the tablet reading logic. Returns false on failure.
        /// </summary>
        public bool Start()
        {
            try
            {
                winTabContext = CWintabInfo.GetDefaultSystemContext(ECTXOptionValues.CXO_MESSAGES | ECTXOptionValues.CXO_SYSTEM);
                winTabData    = new CWintabData(winTabContext);

                // Failed to get the system context
                if (winTabContext == null)
                {
                    return(false);
                }

                winTabContext.Name = "DynamicDraw Tablet Event Data Context";

                WintabAxis tabletX = CWintabInfo.GetTabletAxis(EAxisDimension.AXIS_X);
                WintabAxis tabletY = CWintabInfo.GetTabletAxis(EAxisDimension.AXIS_Y);

                winTabContext.InOrgX = 0;
                winTabContext.InOrgY = 0;
                winTabContext.InExtX = tabletX.axMax;
                winTabContext.InExtY = tabletY.axMax;

                // Tablet origin is usually lower left, invert it to be upper left to match screen coord system.
                winTabContext.OutExtY = -winTabContext.OutExtY;

                bool didOpen = winTabContext.Open();

                winTabData.SetWTPacketEventHandler(UpdateTabletData);

                return(true);
            }
            catch (DllNotFoundException)
            {
                // winTab32.dll is missing. Tablet users will have it; non-tablet users don't need it.
                return(false);
            }
        }
예제 #26
0
        private void HandlePenMessage(Object sender_I, MessageReceivedEventArgs eventArgs_I)
        {
            if (m_wtData == null)
            {
                return;
            }

            try
            {
                uint         pktID = (uint)eventArgs_I.Message.WParam;
                WintabPacket pkt   = m_wtData.GetDataPacket(pktID);
                if (pkt.pkContext != 0)
                {
                    // Normalize data between 0 and 40
                    float normalizedValue = (40f - 0f) / ((float)CWintabInfo.GetMaxPressure() - 0f) * ((float)pkt.pkNormalPressure.pkAbsoluteNormalPressure - (float)CWintabInfo.GetMaxPressure()) + 40f;
                    TabletPressure = normalizedValue;
                }
            }
            catch (Exception ex)
            {
                Log.Fatal(ex.Message);
            }
        }
예제 #27
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
 ///////////////////////////////////////////////////////////////////////
 private void Test_MaxPressure()
 {
     TraceMsg("Max normal pressure is: " + CWintabInfo.GetMaxPressure() + "\n");
     TraceMsg("Max tangential pressure is: " + CWintabInfo.GetMaxPressure(false) + "\n");
 }
예제 #28
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
 ///////////////////////////////////////////////////////////////////////
 private void Test_GetStylusName()
 {
     TraceMsg("Stylus name (puck):   " + CWintabInfo.GetStylusName(EWTICursorNameIndex.CSR_NAME_PUCK) + "\n");
     TraceMsg("Stylus name (pen):    " + CWintabInfo.GetStylusName(EWTICursorNameIndex.CSR_NAME_PRESSURE_STYLUS) + "\n");
     TraceMsg("Stylus name (eraser): " + CWintabInfo.GetStylusName(EWTICursorNameIndex.CSR_NAME_ERASER) + "\n");
 }
예제 #29
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
        ///////////////////////////////////////////////////////////////////////
        private void Test_IsStylusActive()
        {
            bool isStylusActive = CWintabInfo.IsStylusActive();

            TraceMsg("Is stylus active: " + (isStylusActive ? "YES\n" : "NO\n"));
        }
예제 #30
0
파일: TestForm.cs 프로젝트: vvvv/WintabDN
        ///////////////////////////////////////////////////////////////////////
        private void Test_GetNumberOfDevices()
        {
            UInt32 numDevices = CWintabInfo.GetNumberOfDevices();

            TraceMsg("Number of tablets connected: " + numDevices + "\n");
        }