public MotrPstn(uint _uMotrId, uint _uPstnCnt) { m_uMotrId = _uMotrId; m_uMaxPstn = _uPstnCnt; PstnValue = new TPstnValue[_uPstnCnt]; lvPstnView = new ListViewEx(); lvPstnView.Clear(); lvPstnView.View = View.Details; lvPstnView.FullRowSelect = true; lvPstnView.GridLines = true; //셀높이 조절하기 편법. //ImageList dummyImage = new ImageList(); //dummyImage.ImageSize = new System.Drawing.Size(1, iMotrMosCellSize); //(1, 30); //lvPstnView.SmallImageList = dummyImage; //1280*1024 해상도에서 Column 폭 lvPstnView.Columns.Add("Name", iNameWidth, HorizontalAlignment.Left); //150 lvPstnView.Columns.Add("Value", iValueWidth, HorizontalAlignment.Left); //100 lvPstnView.Columns.Add("", iGoWidth, HorizontalAlignment.Left); //55 lvPstnView.Columns.Add("", iInputWidth, HorizontalAlignment.Left); lvPstnView.Columns.Add("Min", iMinMaxWidthName, HorizontalAlignment.Left); lvPstnView.Columns.Add("", iMinMaxWidthVal, HorizontalAlignment.Left); lvPstnView.Columns.Add("Max", iMinMaxWidthName, HorizontalAlignment.Left); lvPstnView.Columns.Add("", iMinMaxWidthVal, HorizontalAlignment.Left); lvPstnView.Columns.Add("Speed % ", iSpeedPerName, HorizontalAlignment.Left); lvPstnView.Columns.Add("", iSpeedPerVal, HorizontalAlignment.Left); //1024*768 해상도에서 Column 폭 //lvPstnView.Columns.Add("Name" , 60, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Value" , 70, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Go" , 35, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Input" , 55, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Min" , 55, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Max" , 55, HorizontalAlignment.Left); lvPstnView.HeaderStyle = ColumnHeaderStyle.None; //lvPstnView.HeaderStyle = ColumnHeaderStyle.Nonclickable; //lvPstnView.OwnerDraw = true; lvPstnView.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(lvDrawColumnHeader); lvPstnView.DrawSubItem += new DrawListViewSubItemEventHandler(lvDrawSubItem); lvPstnView.ColumnWidthChanging += new ColumnWidthChangingEventHandler(lvColumnWidthChanging); ListViewItem[] liInput = new ListViewItem[_uPstnCnt]; var PropInput = lvPstnView.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); PropInput.SetValue(lvPstnView, true, null); btPstnGo = new Button[_uPstnCnt]; btPstnInput = new Button[_uPstnCnt]; //Font BtnFont = new Font("굴림", 10f, FontStyle.Bold); Font BtnFont = new Font("Arial", 10f);//, FontStyle.Bold); for (int i = 0; i < _uPstnCnt; i++) { liInput[i] = new ListViewItem(string.Format("{0:000}", i)); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].UseItemStyleForSubItems = false; //요건 셀별 색깔 넣을때. liInput[i].UseItemStyleForSubItems = false; lvPstnView.Items.Add(liInput[i]); btPstnGo[i] = new Button(); btPstnInput[i] = new Button(); btPstnGo[i].Tag = i; btPstnInput[i].Tag = i; btPstnGo[i].Font = BtnFont; btPstnInput[i].Font = BtnFont; btPstnGo[i].Text = "GO"; btPstnInput[i].Text = "INPUT"; btPstnGo[i].BackColor = Color.Aqua; btPstnInput[i].BackColor = Color.Lime; lvPstnView.AddEmbeddedControl(btPstnGo[i], 2, i); lvPstnView.AddEmbeddedControl(btPstnInput[i], 3, i); //lvPstnView.Items[i].SubItems[1].Font = BtnFont; lvPstnView.Items[i].SubItems[0].BackColor = Color.Silver; lvPstnView.Items[i].SubItems[4].BackColor = Color.Silver; lvPstnView.Items[i].SubItems[5].BackColor = Color.Silver; lvPstnView.Items[i].SubItems[6].BackColor = Color.Silver; lvPstnView.Items[i].SubItems[7].BackColor = Color.Silver; lvPstnView.Items[i].SubItems[8].BackColor = Color.Silver; lvPstnView.Items[i].SubItems[9].BackColor = Color.Silver; btPstnGo[i].Click += new EventHandler(btGoClick); btPstnInput[i].Click += new EventHandler(btInputClick); } tbPstnEdit = new TextBox(); tbPstnEdit.Visible = false; tbPstnEdit.BorderStyle = BorderStyle.FixedSingle; tbPstnEdit.Tag = 0; tbPstnEdit.Leave += tbPstnEdit_Leave; tbPstnEdit.KeyDown += tbPstnEdit_KeyDown; tbPstnMinEdit = new TextBox(); tbPstnMinEdit.Visible = false; tbPstnMinEdit.BorderStyle = BorderStyle.FixedSingle; tbPstnMinEdit.Tag = 0; tbPstnMinEdit.Leave += tbPstnMinEdit_Leave; tbPstnMinEdit.KeyDown += tbPstnMinEdit_KeyDown; tbPstnMaxEdit = new TextBox(); tbPstnMaxEdit.Visible = false; tbPstnMaxEdit.BorderStyle = BorderStyle.FixedSingle; tbPstnMaxEdit.Tag = 0; tbPstnMaxEdit.Leave += tbPstnMaxEdit_Leave; tbPstnMaxEdit.KeyDown += tbPstnMaxEdit_KeyDown; tbPstnSpdEdit = new TextBox(); tbPstnSpdEdit.Visible = false; tbPstnSpdEdit.BorderStyle = BorderStyle.FixedSingle; tbPstnSpdEdit.Tag = 0; tbPstnSpdEdit.Leave += tbPstnSpdEdit_Leave; tbPstnSpdEdit.KeyDown += tbPstnSpdEdit_KeyDown; lvPstnView.AddEmbeddedControl(tbPstnEdit, 1, 0); lvPstnView.AddEmbeddedControl(tbPstnMinEdit, 5, 0); lvPstnView.AddEmbeddedControl(tbPstnMaxEdit, 7, 0); lvPstnView.AddEmbeddedControl(tbPstnSpdEdit, 9, 0); lvPstnView.Click += new EventHandler(lvPstnView_Click); //for (int i = 0; i < _uMotrId; i++) //{ // btPstnGo[_uPstnCnt].Click += new EventHandler(btGoClick); // btPstnInput[_uPstnCnt].Click += new EventHandler(btInputClick); //} //lvPstnView.DrawItem += new DrawListViewItemEventHandler(lvPstnView_DrawItem); //lvPstnView.OwnerDraw = true ; }
public MotrPstn(uint _uMotrId, uint _uPstnCnt) { m_uMotrId = _uMotrId; m_uMaxPstn = _uPstnCnt; PstnValue = new TPstnValue[_uPstnCnt]; lvPstnView = new ListViewEx(); lvPstnView.Clear(); lvPstnView.View = View.Details; lvPstnView.FullRowSelect = true; lvPstnView.GridLines = true; //셀높이 조절하기 편법. ImageList dummyImage = new ImageList(); dummyImage.ImageSize = new System.Drawing.Size(1, 30); lvPstnView.SmallImageList = dummyImage; //1280*1024 해상도에서 Column 폭 lvPstnView.Columns.Add("Name", 150, HorizontalAlignment.Left); lvPstnView.Columns.Add("Value", 100, HorizontalAlignment.Left); lvPstnView.Columns.Add("Go", 55, HorizontalAlignment.Left); lvPstnView.Columns.Add("Input", 75, HorizontalAlignment.Left); //1024*768 해상도에서 Column 폭 //lvPstnView.Columns.Add("Name" , 60, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Value" , 70, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Go" , 35, HorizontalAlignment.Left); //lvPstnView.Columns.Add("Input" , 55, HorizontalAlignment.Left); lvPstnView.HeaderStyle = ColumnHeaderStyle.None; ListViewItem [] liInput = new ListViewItem [_uPstnCnt]; var PropInput = lvPstnView.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); PropInput.SetValue(lvPstnView, true, null); btPstnGo = new Button[_uPstnCnt]; btPstnInput = new Button[_uPstnCnt]; for (int i = 0; i < _uPstnCnt; i++) { liInput[i] = new ListViewItem(string.Format("{0:000}", i)); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].SubItems.Add(""); liInput[i].UseItemStyleForSubItems = false; //요건 셀별 색깔 넣을때. liInput[i].UseItemStyleForSubItems = false; lvPstnView.Items.Add(liInput[i]); btPstnGo [i] = new Button(); btPstnInput[i] = new Button(); btPstnGo [i].Tag = i; btPstnInput[i].Tag = i; btPstnGo [i].Text = "GO"; btPstnInput[i].Text = "INPUT"; btPstnGo [i].BackColor = Color.Aqua; btPstnInput[i].BackColor = Color.Lime; lvPstnView.AddEmbeddedControl(btPstnGo [i], 2, i); lvPstnView.AddEmbeddedControl(btPstnInput[i], 3, i); lvPstnView.Items[i].SubItems[0].BackColor = Color.Silver; btPstnGo[i].Click += new EventHandler(btGoClick); btPstnInput[i].Click += new EventHandler(btInputClick); } tbPstnEdit = new TextBox(); tbPstnEdit.Visible = false; tbPstnEdit.BorderStyle = BorderStyle.FixedSingle; tbPstnEdit.Tag = 0; tbPstnEdit.Leave += tbPstnEdit_Leave; tbPstnEdit.KeyDown += tbPstnEdit_KeyDown; lvPstnView.AddEmbeddedControl(tbPstnEdit, 1, 0); lvPstnView.Click += new EventHandler(lvPstnView_Click); //for (int i = 0; i < _uMotrId; i++) //{ // btPstnGo[_uPstnCnt].Click += new EventHandler(btGoClick); // btPstnInput[_uPstnCnt].Click += new EventHandler(btInputClick); //} //lvPstnView.DrawItem += new DrawListViewItemEventHandler(lvPstnView_DrawItem); //lvPstnView.OwnerDraw = true ; }
public ListViewItem[] liInput = new ListViewItem[MAX_DSP_CMD];//이거 노드카운트 수량만큼 만들어야함 public void InitNodePosView(Panel _pnBase) { lvNodePos = new ListViewEx(); //PttValue = new TPttValue[GetPosCnt()]; lvNodePos.Parent = _pnBase; lvNodePos.Dock = DockStyle.Fill; lvNodePos.Clear(); lvNodePos.View = View.Details; lvNodePos.FullRowSelect = true; lvNodePos.MultiSelect = true; lvNodePos.GridLines = true; //셀높이 조절하기 편법. ImageList dummyImage = new ImageList(); dummyImage.ImageSize = new System.Drawing.Size(1, 25); lvNodePos.SmallImageList = dummyImage; lvNodePos.Columns.Add("", 80, HorizontalAlignment.Left); lvNodePos.Columns.Add("X Pos", 70, HorizontalAlignment.Left); lvNodePos.Columns.Add("Y Pos", 70, HorizontalAlignment.Left); lvNodePos.Columns.Add("Z Pos", 70, HorizontalAlignment.Left); lvNodePos.Columns.Add("X Scale", 80, HorizontalAlignment.Left); lvNodePos.Columns.Add("Y Scale", 80, HorizontalAlignment.Left); lvNodePos.Columns.Add("Disp", 50, HorizontalAlignment.Left); for (int i = 0; i < GetDispPosCnt(); i++) { liInput[i] = new ListViewItem("NODE" + i.ToString()); for (int j = 0; j < lvNodePos.Columns.Count; j++) { liInput[i].SubItems.Add(""); } liInput[i].UseItemStyleForSubItems = false; lvNodePos.Items.Add(liInput[i]); } var PropInput = lvNodePos.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); PropInput.SetValue(lvNodePos, true, null); tbPttEdit = new TextBox(); tbPttEdit.Visible = false; tbPttEdit.BorderStyle = BorderStyle.FixedSingle; tbPttEdit.Tag = 0; tbPttEdit.Leave += tbPttEdit_Leave; tbPttEdit.KeyDown += tbPttEdit_KeyDown; if (GetDispPosCnt() != 0) { lvNodePos.AddEmbeddedControl(tbPttEdit, 1, 0); } lvNodePos.Click += new EventHandler(lvNodePos_Click); }
private void InitNodePosView(Panel _pnBase) { lvNodePos = new ListViewEx(); lvNodePos.Parent = _pnBase; lvNodePos.Dock = DockStyle.Fill; //NodePositions ListView========================== const int iCellWidth = 103; const int icbWidth = 103; string [] sCBData = { "Left", "Right" }; cbDirctn = new ComboBox();//[(int)OM.MAX_NODE_POS]; cbDirctn.Items.AddRange(sCBData); cbDirctn.Visible = false; tbText = new TextBox(); tbText.Visible = false; tbText.BorderStyle = BorderStyle.FixedSingle; tbText.Tag = 0; tbText.Leave += tbText_Leave; tbText.KeyDown += tbText_KeyDown; lvNodePos.Clear(); lvNodePos.View = View.Details; lvNodePos.FullRowSelect = true; lvNodePos.MultiSelect = true; lvNodePos.GridLines = true; //셀높이 조절하기 편법. ImageList dummyImage = new ImageList(); dummyImage.ImageSize = new System.Drawing.Size(1, 23); lvNodePos.SmallImageList = dummyImage; lvNodePos.Columns.Add("No", 40, HorizontalAlignment.Left); lvNodePos.Columns.Add("Start Pos", iCellWidth, HorizontalAlignment.Left); lvNodePos.Columns.Add("Direction", icbWidth, HorizontalAlignment.Left); lvNodePos.Columns.Add("Degree", iCellWidth, HorizontalAlignment.Left); lvNodePos.Columns.Add("WorkCount", iCellWidth, HorizontalAlignment.Left); lvNodePos.Columns.Add("WorkPitch", iCellWidth, HorizontalAlignment.Left); ListViewItem[] liInput = new ListViewItem[ilvNodeCnt]; for (int i = 0; i < ilvNodeCnt; i++) { liInput[i] = new ListViewItem(i.ToString()); for (int j = 1; j < lvNodePos.Columns.Count; j++) { liInput[i].SubItems.Add("0"); } liInput[i].UseItemStyleForSubItems = false; lvNodePos.Items.Add(liInput[i]); //cbDirctn[i].Text = "Input"; lvNodePos.AddEmbeddedControl(cbDirctn, 2, i); } for (int i = 0; i < ilvNodeCnt; i++) { for (int j = 1; j < lvNodePos.Columns.Count; j++) { lvNodePos.AddEmbeddedControl(tbText, j, i); } } lvNodePos.Click += new EventHandler(lvNodePos_Click); tbText.KeyDown += new KeyEventHandler(tbText_KeyDown); cbDirctn.SelectedIndexChanged += new EventHandler(cbDirctn_SelectedIndexChanged); //lvNodePos.SelectedIndexChanged += new EventHandler(lvNodePos_SelectedIndexChanged); var PropInput = lvNodePos.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); PropInput.SetValue(lvNodePos, true, null); PropInput = cbDirctn.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); PropInput.SetValue(cbDirctn, true, null); PropInput = tbText.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); PropInput.SetValue(tbText, true, null); }