protected override void DrawGrid(Graphics drawZoonGraphic, RectangularGridInfo curGird) { base.DrawGrid(drawZoonGraphic, curGird); _tempCustomInfo = new SetCustomObjInfo(); _tempCustomInfo = (SetCustomObjInfo)curGird.CustomObj; if (_tempCustomInfo == null) { return; } _oneHeight = curGird.DrawRegion.Height - this.DefaultStyle.BoardWidth; _strSizeF = GetStrSize(drawZoonGraphic, _tempCustomInfo.Count.ToString()); if (GetImageRectFAndDetectIsDrawStr(new RectangleF(curGird.DrawRegion.X, curGird.DrawRegion.Y, curGird.DrawRegion.Width - this.DefaultStyle.BoardWidth, curGird.DrawRegion.Height - this.DefaultStyle.BoardWidth), _strSizeF, out _imageRectF)) { _strRectF = new RectangleF(curGird.DrawRegion.X + _imageRectF.Width + ImageAndStrInterval * 2, curGird.DrawRegion.Y, curGird.DrawRegion.Width - _imageRectF.Width - ImageAndStrInterval * 2, _oneHeight); DrawStrForLeft(drawZoonGraphic, _tempCustomInfo.Count.ToString(), _strRectF); } if (_commonInfo.IconImage != null) { drawZoonGraphic.DrawImage(_commonInfo.IconImage, _imageRectF); } #region Bitmap -- Test //if (_isDrawBitMap) //{ // _tempBitMap1 = new Bitmap(_fanImage, (int)_imageRectF.Width, (int)_imageRectF.Height); // _bmpInf.bmiHeader.biHeight = -_tempBitMap1.Height; // _lineBytes = ((_tempBitMap1.Width * 24 + 32) >> 5) << 2; // _bmpInf.bmiHeader.biSizeImage = _lineBytes * _tempBitMap1.Height; // _bmpInf.bmiHeader.biWidth = _tempBitMap1.Width; // _tempBitMap = _tempBitMap1.Clone(new Rectangle(0, 0, _tempBitMap1.Width, _tempBitMap1.Height), // PixelFormat.Format32bppArgb); // _bmpData = _tempBitMap.LockBits(new Rectangle(0, 0, _tempBitMap.Width, _tempBitMap.Height), // ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); // _hDrawPanel = drawZoonGraphic.GetHdc(); // SetDIBitsToDevice(_hDrawPanel, (int)_imageRectF.X, (int)_imageRectF.Y, (uint)_imageRectF.Width, // (uint)_imageRectF.Height, 0, 0, (uint)0, (uint)_tempBitMap.Height, _bmpData.Scan0, // ref _bmpInf, 0); // _tempBitMap.UnlockBits(_bmpData); // drawZoonGraphic.ReleaseHdc(_hDrawPanel); // _tempBitMap.Dispose(); // _tempBitMap1.Dispose(); //} //else //{ // drawZoonGraphic.DrawImage(_fanImage, _imageRectF); //} #endregion }
private void UpdateDisplay() { if (_ledType == LEDDisplyType.ComplexType) { for (int i = 0; i < _curLedInf.ScannerCount; i++) { _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone(); _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); if (!_curSettingDic.ContainsKey(_tempAddr)) { _curSettingDic.Add(_tempAddr, _commonInfo.SameCount); if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount); } } _complexLayout.AddOneMonitorCardInf(_tempAddr, _curSettingDic[_tempAddr]); } } else { Point screenLocation = _curLedInf.GetScreenPosition(); for (int i = 0; i < _curLedInf.ScannerCount; i++) { if (_curLedInf[i] == null || _curLedInf[i].SenderIndex == 255) { continue; } _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone(); _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); _tempRect = new Rectangle(_scanBoardTempInfo.X - screenLocation.X, _scanBoardTempInfo.Y - screenLocation.Y, _scanBoardTempInfo.Width, _scanBoardTempInfo.Height); if (!_curSettingDic.ContainsKey(_tempAddr)) { _curSettingDic.Add(_tempAddr, _commonInfo.SameCount); if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount); } } _tempCustomInfo = new SetCustomObjInfo(); _tempCustomInfo.ScanBordInfo = _scanBoardTempInfo; _tempCustomInfo.Count = _curSettingDic[_tempAddr]; _standarAndSimpleLayout.AddRectangularGrid(_tempRect, _tempAddr, _tempCustomInfo); } _standarAndSimpleLayout.InvalidateDrawArea(); } }
/// <summary> /// 鼠标移动事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StandarAndSimpleLayout_GridMouseMove(object sender, RectangularGridMouseEventArgs e) { if (_customToolTip == null) { _customToolTip = new CustomToolTip(); _customToolTip.Owner = this.ParentForm; _customToolTip.TipContentFont = _customToolTipFont; } if (e.GridInfo == null) { //当前鼠标移动到的区域无矩形格子 _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, null); Debug.WriteLine("进入格子的GridMouseMove事件,并获取的格子信息为空"); return; } RectangularGridInfo scanBordGridInfo = _standarAndSimpleLayout[e.GridInfo.Key]; List <string> noticeStrList = null; if (scanBordGridInfo != null) { _tempCustomInfo = (SetCustomObjInfo)scanBordGridInfo.CustomObj; if (_tempCustomInfo == null) { _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, null); return; } noticeStrList = new List <string>(); _tempCnt = _tempCustomInfo.Count; noticeStrList.Add(StaticValue.SenderName + ":" + (_tempCustomInfo.ScanBordInfo.SenderIndex + 1)); noticeStrList.Add(StaticValue.PortName + ":" + (_tempCustomInfo.ScanBordInfo.PortIndex + 1)); noticeStrList.Add(StaticValue.ScanBoardName + ":" + (_tempCustomInfo.ScanBordInfo.ConnectIndex + 1)); noticeStrList.Add("(X, Y):(" + e.GridInfo.Region.X + "," + e.GridInfo.Region.Y + ")"); noticeStrList.Add("(W, H):(" + e.GridInfo.Region.Width + "," + e.GridInfo.Region.Height + ")"); noticeStrList.Add(StaticValue.CountStr + ":" + _tempCustomInfo.Count); } _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, noticeStrList); if (!_customToolTip.TopLevel) { _customToolTip.TopLevel = true; } }
private void crystalButton_Resume_Click(object sender, EventArgs e) { string info = Frm_FanPowerAdvanceSetting.GetLangControlText("WhetherSetDefaultValue", "确认需要将当前显示屏的监控信息设置为默认值?"); if (CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "", MessageBoxButtons.YesNo, MessageBoxIconType.Question) == DialogResult.No) { return; } if (_ledType == LEDDisplyType.ComplexType) { _complexLayout.ResumeDefaultCount(_commonInfo.SameCount); } else { for (int i = 0; i < _curLedInf.ScannerCount; i++) { _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone(); _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); _tempCustomInfo = new SetCustomObjInfo(); _tempCustomInfo.Count = _commonInfo.SameCount; _tempCustomInfo.ScanBordInfo = _scanBoardTempInfo; _standarAndSimpleLayout.GridDic[_tempAddr].CustomObj = _tempCustomInfo; _curSettingDic[_tempAddr] = _commonInfo.SameCount; if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount); } } _standarAndSimpleLayout.InvalidateDrawArea(); } }
private void StandarAndSimpleLayout_GridMouseDoubleClick(object sender, RectangularGridMouseEventArgs e) { if (e.GridInfo == null) { return; } _tempCustomInfo = (SetCustomObjInfo)e.GridInfo.CustomObj; if (_tempCustomInfo == null) { return; } _scanBoardTempInfo = (ScanBoardRegionInfo)_tempCustomInfo.ScanBordInfo.Clone(); _tempCnt = _tempCustomInfo.Count; _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount); if (_setInfoFrm.ShowDialog() == DialogResult.OK) { _tempCustomInfo.Count = _setInfoFrm.Count; _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); _standarAndSimpleLayout.GridDic[_tempAddr].CustomObj = _tempCustomInfo; _curSettingDic[_tempAddr] = _setInfoFrm.Count; if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _setInfoFrm.Count); } _standarAndSimpleLayout.InvalidateDrawArea(); } }
private void UpdateDisplay() { if (_ledType == LEDDisplyType.ComplexType) { for (int i = 0; i < _curLedInf.ScannerCount; i++) { _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone(); _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); if (!_curSettingDic.ContainsKey(_tempAddr)) { _curSettingDic.Add(_tempAddr, _commonInfo.SameCount); if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount); } } _complexLayout.AddOneMonitorCardInf(_tempAddr, _curSettingDic[_tempAddr]); } } else { Point screenLocation = _curLedInf.GetScreenPosition(); for (int i = 0; i < _curLedInf.ScannerCount; i++) { if(_curLedInf[i] == null || _curLedInf[i].SenderIndex == 255) { continue; } _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone(); _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); _tempRect = new Rectangle(_scanBoardTempInfo.X - screenLocation.X, _scanBoardTempInfo.Y - screenLocation.Y, _scanBoardTempInfo.Width, _scanBoardTempInfo.Height); if (!_curSettingDic.ContainsKey(_tempAddr)) { _curSettingDic.Add(_tempAddr, _commonInfo.SameCount); if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount); } } _tempCustomInfo = new SetCustomObjInfo(); _tempCustomInfo.ScanBordInfo = _scanBoardTempInfo; _tempCustomInfo.Count = _curSettingDic[_tempAddr]; _standarAndSimpleLayout.AddRectangularGrid(_tempRect, _tempAddr, _tempCustomInfo); } _standarAndSimpleLayout.InvalidateDrawArea(); } }
/// <summary> /// ����ƶ��¼� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StandarAndSimpleLayout_GridMouseMove(object sender, RectangularGridMouseEventArgs e) { if (_customToolTip == null) { _customToolTip = new CustomToolTip(); _customToolTip.Owner = this.ParentForm; _customToolTip.TipContentFont = _customToolTipFont; } if (e.GridInfo == null) { //��ǰ����ƶ������������θ��� _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, null); Debug.WriteLine("������ӵ�GridMouseMove�¼�������ȡ�ĸ�����ϢΪ��"); return; } RectangularGridInfo scanBordGridInfo = _standarAndSimpleLayout[e.GridInfo.Key]; List<string> noticeStrList = null; if (scanBordGridInfo != null) { _tempCustomInfo = (SetCustomObjInfo)scanBordGridInfo.CustomObj; if (_tempCustomInfo == null) { _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, null); return; } noticeStrList = new List<string>(); _tempCnt = _tempCustomInfo.Count; noticeStrList.Add(StaticValue.SenderName + ":" + (_tempCustomInfo.ScanBordInfo.SenderIndex + 1)); noticeStrList.Add(StaticValue.PortName + ":" + (_tempCustomInfo.ScanBordInfo.PortIndex + 1)); noticeStrList.Add(StaticValue.ScanBoardName + ":" + (_tempCustomInfo.ScanBordInfo.ConnectIndex + 1)); noticeStrList.Add("(X, Y):(" + e.GridInfo.Region.X + "," + e.GridInfo.Region.Y + ")"); noticeStrList.Add("(W, H):(" + e.GridInfo.Region.Width + "," + e.GridInfo.Region.Height + ")"); noticeStrList.Add(StaticValue.CountStr + ":" + _tempCustomInfo.Count); } _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, noticeStrList); if (!_customToolTip.TopLevel) { _customToolTip.TopLevel = true; } }
private void crystalButton_SetSelect_Click(object sender, EventArgs e) { if (_ledType == LEDDisplyType.ComplexType) { if (_complexLayout.SelectedItemRowsItems.Count <= 0) { string info = Frm_FanPowerAdvanceSetting.GetLangControlText("PleaseSelectScanBoard", "��ѡ����Ҫ���õĽ��տ�!"); CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "", MessageBoxButtons.OK, MessageBoxIconType.Alert); return; } if (_complexLayout.SelectedItemRowsItems.Count == 1) { bool bGetRes = _complexLayout.GetCountByRowIndex(_complexLayout.SelectedItemRowsItems[0].Index, out _tempCnt); } else { _tempCnt = _commonInfo.SameCount; } _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount); if (_setInfoFrm.ShowDialog() == DialogResult.OK) { _complexLayout.SetCountForSelectedItems(_setInfoFrm.Count); } } else { if (_standarAndSimpleLayout.SelectedGrid == null || _standarAndSimpleLayout.SelectedGrid.Count <= 0) { string info = Frm_FanPowerAdvanceSetting.GetLangControlText("PleaseSelectScanBoard", "��ѡ����Ҫ���õĽ��տ�!"); CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "", MessageBoxButtons.OK, MessageBoxIconType.Alert); return; } if (_standarAndSimpleLayout.SelectedGrid.Count == 1) { _tempCustomInfo = (SetCustomObjInfo)_standarAndSimpleLayout.SelectedGrid[0].CustomObj; if (_tempCustomInfo == null) { return; } _tempCnt = _tempCustomInfo.Count; } else { _tempCnt = _commonInfo.SameCount; } _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount); if (_setInfoFrm.ShowDialog() == DialogResult.OK) { for (int i = 0; i < _standarAndSimpleLayout.SelectedGrid.Count; i++) { _tempCustomInfo = (SetCustomObjInfo)_standarAndSimpleLayout.SelectedGrid[i].CustomObj; if (_tempCustomInfo == null) { continue; } _scanBoardTempInfo = (ScanBoardRegionInfo)_tempCustomInfo.ScanBordInfo.Clone(); _tempCustomInfo.Count = _setInfoFrm.Count; _standarAndSimpleLayout.SelectedGrid[i].CustomObj = _tempCustomInfo; _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); _curSettingDic[_tempAddr] = _setInfoFrm.Count; if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _setInfoFrm.Count); } } _standarAndSimpleLayout.InvalidateDrawArea(); } } }
private void crystalButton_Resume_Click(object sender, EventArgs e) { string info = Frm_FanPowerAdvanceSetting.GetLangControlText("WhetherSetDefaultValue", "ȷ����Ҫ����ǰ��ʾ���ļ����Ϣ����ΪĬ��ֵ?"); if (CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "", MessageBoxButtons.YesNo, MessageBoxIconType.Question) == DialogResult.No) { return; } if (_ledType == LEDDisplyType.ComplexType) { _complexLayout.ResumeDefaultCount(_commonInfo.SameCount); } else { for (int i = 0; i < _curLedInf.ScannerCount; i++) { _scanBoardTempInfo = (ScanBoardRegionInfo)_curLedInf[i].Clone(); _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); _tempCustomInfo = new SetCustomObjInfo(); _tempCustomInfo.Count = _commonInfo.SameCount; _tempCustomInfo.ScanBordInfo = _scanBoardTempInfo; _standarAndSimpleLayout.GridDic[_tempAddr].CustomObj = _tempCustomInfo; _curSettingDic[_tempAddr] = _commonInfo.SameCount; if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _commonInfo.SameCount); } } _standarAndSimpleLayout.InvalidateDrawArea(); } }
private void crystalButton_SetSelect_Click(object sender, EventArgs e) { if (_ledType == LEDDisplyType.ComplexType) { if (_complexLayout.SelectedItemRowsItems.Count <= 0) { string info = Frm_FanPowerAdvanceSetting.GetLangControlText("PleaseSelectScanBoard", "请选中需要设置的接收卡!"); CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "", MessageBoxButtons.OK, MessageBoxIconType.Alert); return; } if (_complexLayout.SelectedItemRowsItems.Count == 1) { bool bGetRes = _complexLayout.GetCountByRowIndex(_complexLayout.SelectedItemRowsItems[0].Index, out _tempCnt); } else { _tempCnt = _commonInfo.SameCount; } _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount); if (_setInfoFrm.ShowDialog() == DialogResult.OK) { _complexLayout.SetCountForSelectedItems(_setInfoFrm.Count); } } else { if (_standarAndSimpleLayout.SelectedGrid == null || _standarAndSimpleLayout.SelectedGrid.Count <= 0) { string info = Frm_FanPowerAdvanceSetting.GetLangControlText("PleaseSelectScanBoard", "请选中需要设置的接收卡!"); CustomMessageBox.ShowTopMostCustomMessageBox(this.ParentForm, info, "", MessageBoxButtons.OK, MessageBoxIconType.Alert); return; } if (_standarAndSimpleLayout.SelectedGrid.Count == 1) { _tempCustomInfo = (SetCustomObjInfo)_standarAndSimpleLayout.SelectedGrid[0].CustomObj; if (_tempCustomInfo == null) { return; } _tempCnt = _tempCustomInfo.Count; } else { _tempCnt = _commonInfo.SameCount; } _setInfoFrm = new Frm_SetInfo(_commonInfo.TypeStr, _tempCnt, _commonInfo.MaxCount); if (_setInfoFrm.ShowDialog() == DialogResult.OK) { for (int i = 0; i < _standarAndSimpleLayout.SelectedGrid.Count; i++) { _tempCustomInfo = (SetCustomObjInfo)_standarAndSimpleLayout.SelectedGrid[i].CustomObj; if (_tempCustomInfo == null) { continue; } _scanBoardTempInfo = (ScanBoardRegionInfo)_tempCustomInfo.ScanBordInfo.Clone(); _tempCustomInfo.Count = _setInfoFrm.Count; _standarAndSimpleLayout.SelectedGrid[i].CustomObj = _tempCustomInfo; _tempAddr = StaticFunction.GetSBAddr(_commPort, _scanBoardTempInfo.SenderIndex, _scanBoardTempInfo.PortIndex, _scanBoardTempInfo.ConnectIndex); _curSettingDic[_tempAddr] = _setInfoFrm.Count; if (_setOneScanBoardInfoEvent != null) { _setOneScanBoardInfoEvent.Invoke(_tempAddr, _setInfoFrm.Count); } } _standarAndSimpleLayout.InvalidateDrawArea(); } } }