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); }
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) { } }
/////////////////////////////////////////////////////////////////////// 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); }
/////////////////////////////////////////////////////////////////////// private void Test_GetDefaultDigitizingContext() { CWintabContext context = CWintabInfo.GetDefaultDigitizingContext(); TraceMsg("Default Digitizing 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"); }
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); }
private bool InitWintab() { bool status = false; try { mLogContext = CWintabInfo.GetDefaultDigitizingContext(ECTXOptionValues.CXO_MESSAGES); if (mLogContext == null) { return(false); //throw new Exception("Oops - FAILED GetDefaultDigitizingContext"); } // Control system cursor. mLogContext.Options |= (UInt32)ECTXOptionValues.CXO_SYSTEM; // Verify which extensions are available for targeting. // Once we know what the tablet supports, we can set up the data packet // definition to be sent events from those control types. // All tablets should have at least expresskeys. mExpKeysMask = CWintabExtensions.GetWTExtensionMask(EWTXExtensionTag.WTX_EXPKEYS2); if (mExpKeysMask > 0) { mLogContext.PktData |= (WTPKT)mExpKeysMask; } else { Debug.WriteLine("InitWintab: WTX_EXPKEYS2 mask not found!"); throw new Exception("Oops - FAILED GetWTExtensionMask for WTX_EXPKEYS2"); } // It's not an error if either / both of these are zero. It simply means // that those control types are not supported. mTouchRingMask = CWintabExtensions.GetWTExtensionMask(EWTXExtensionTag.WTX_TOUCHRING); if (mTouchRingMask > 0) { mLogContext.PktData |= (WTPKT)mTouchRingMask; } mTouchStripMask = CWintabExtensions.GetWTExtensionMask(EWTXExtensionTag.WTX_TOUCHSTRIP); if (mTouchStripMask > 0) { mLogContext.PktData |= (WTPKT)mTouchStripMask; } status = mLogContext.Open(); if (!status) { //throw new Exception("Oops - failed logContext.Open()"); return(false); } // Setup controls and overrides for first tablet. SetupControlsForTablet(mTabletIndexDefault); // Create a data object and set its WT_PACKET handler. m_wtData = new CWintabData(mLogContext); m_wtData.SetWTPacketEventHandler(MyWTPacketEventHandler); } catch (Exception ex) { MessageBox.Show("FormExtTestApp: InitWintab: " + ex.ToString()); } return(true); }
private void Test_GetDefaultDigitizingContext() { CWintabContext context = CWintabInfo.GetDefaultDigitizingContext(); }