// 描画領域の計算 private void spb(int x, int y, DV.GVIEW_PANEL_INFO lpPanel) { int ny = y / 8; int by = y % 8; lpPanel.Buffer[ny * lpPanel.SizeOfXBytes + x] |= (byte)(1 << by); }
// コンストラクタ(シングルトンなのでprivate) private MyDotView(Form1 fm) { fm1 = fm; _WindowHandle = fm; DvCtl = new DV.Control(); dPanelFixed = new DV.GVIEW_PANEL_INFO(); dPanelBlinking = new DV.GVIEW_PANEL_INFO(); EquipmentName = null; TextSize = 0; GrpX = 0; GrpY = 0; }
// コンストラクタ(シングルトンなのでprivate) private MyDotView(MainForm mF) { mainform = mF; //ここは一番大事! mainform.Text = ""; _WindowHandle = mF; DvCtl = new DV.Control(); dPanelFixed = new DV.GVIEW_PANEL_INFO(); dPanelBlinking = new DV.GVIEW_PANEL_INFO(); EquipmentName = null; TextSize = 0; GrpX = 0; GrpY = 0; }
// DV2の接続と描画領域の初期化 public void Connect() { bool bRet = false; #if USE_DIALOG bRet = DvCtl.SelectStartDialog(_WindowHandle); #else bRet = DvCtl.DirectStartConnect(_WindowHandle, GnHardIdx, gnPortIdx); #endif if (!bRet) { //MessageBox.Show("@Connect関数 DotViewの接続に失敗した"); mainform.textBox_code.AppendText(" @MyDotView.cs Connect関数 -> DotViewの接続に失敗した " + "\r\n"); isConnect = false; return; } bRet = false; for (int nCount = 0; nCount < 20; nCount++) { bRet = DvCtl.QueryEquipment(-1, out EquipmentName, out TextSize, out GrpX, out GrpY); if (bRet) { break; } Thread.Sleep(100); } if (!bRet) { //MessageBox.Show("@Connect関数 DotViewの初期化は失敗した"); mainform.textBox_code.AppendText(" @MyDotView.cs Connect関数 -> DotViewの初期化は失敗した " + "\r\n"); isConnect = false; return; } DvCtl.StartDisplayMode(DV.DispMode.FOREGROUND); DvCtl.HideControlBoxWindow(true); dPanelFixed = DvCtl.NewPanel(GrpX, GrpY); dPanelBlinking = DvCtl.NewPanel(GrpX, GrpY); Array.Clear(dPanelFixed.Buffer, 0, dPanelFixed.SizeOfDataBytes); Array.Clear(dPanelBlinking.Buffer, 0, dPanelBlinking.SizeOfDataBytes); isConnect = true; return; }