private void CommonPanel_Paint(object sender, PaintEventArgs e) { try { e.Graphics.FillRectangle(Brushes.White, 0, 0, CommonPanel.Width, CommonPanel.Height); int kx = CommonPanel.Width / 18; int ky = CommonPanel.Height / 7; for (int i = 0; i < FobidenElements.Items.Count; i++) { int x = kx * 4; int y = 2 + i * 10; Brush br = new SolidBrush(ElementTable.GetColorForType((ElementTypes)i)); e.Graphics.FillRectangle(br, x - kx, y, kx - 2, 10); e.Graphics.DrawString(ElementTable.GetNameOfType((ElementTypes)i), DefaultFont, Brushes.Black, x, y); } for (int i = 0; i < ElementTable.Elements.Length; i++) { //SelectionAtomNum[ElementTable.Elements[i].Num] = SelectionTable[i]; if (ElementTable.Elements[i].Row >= 9) { continue; } int x = kx * (ElementTable.Elements[i].Col - 1); int y = ky * (ElementTable.Elements[i].Row - 1); SelectionRect[i] = new Rectangle(x, y, kx, ky); Brush br; Brush tbr; if (SelectionTable[i] == false) { br = new SolidBrush(ElementTable.GetColorForType(ElementTable.Elements[i].Type)); tbr = Brushes.Black; } else { br = Brushes.Blue; tbr = Brushes.White; } if (FobidenElements.GetItemChecked((int)ElementTable.Elements[i].Type)) { br = Brushes.White; tbr = Brushes.LightGray; } e.Graphics.FillRectangle(br, x, y, kx, ky); e.Graphics.DrawString(ElementTable.Elements[i].Name, DefaultFont, tbr, x + 2, y + 2); if (ElementTable.Elements[i].Name[0] != '*') { e.Graphics.DrawString(ElementTable.Elements[i].Num.ToString(), Lf, tbr, x + 1, y + ky / 2); } e.Graphics.DrawRectangle(Pens.Black, x, y, kx, ky); } } catch (Exception ex) { Log.OutNoMsg(ex); } }
private void REPanel_Paint(object sender, PaintEventArgs e) { try { e.Graphics.FillRectangle(Brushes.White, 0, 0, REPanel.Width, REPanel.Height); int kx = REPanel.Width / 15; int ky = REPanel.Height / 2; for (int i = 0; i < ElementTable.Elements.Length; i++) { //SelectionAtomNum[ElementTable.Elements[i].Num] = SelectionTable[i]; if (ElementTable.Elements[i].Row < 9) { continue; } int x = kx * (ElementTable.Elements[i].Col - 1); int y = ky * (ElementTable.Elements[i].Row - 9); SelectionRect[i] = new Rectangle(x, y, kx, ky); Brush br; Brush tbr; if (SelectionTable[i] == false) { br = new SolidBrush(ElementTable.GetColorForType(ElementTable.Elements[i].Type)); tbr = Brushes.Black; } else { br = Brushes.Blue; tbr = Brushes.White; } if (FobidenElements.GetItemChecked((int)ElementTable.Elements[i].Type)) { br = Brushes.White; tbr = Brushes.LightGray; } e.Graphics.FillRectangle(br, x, y, kx, ky); e.Graphics.DrawString(ElementTable.Elements[i].Name, DefaultFont, tbr, x + 4, y + 2); e.Graphics.DrawString(ElementTable.Elements[i].Num.ToString(), Lf, tbr, x + 1, y + ky / 2); e.Graphics.DrawRectangle(Pens.Black, x, y, kx, ky); } } catch (Exception ex) { Log.OutNoMsg(ex); } }