private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            selectedElement = null;

            if (!Enabled)
                return;

            // test hit on element
            int group = 19 * (ptWidth / (e.X - tableOrigin.Width));
            int period = 8 * (ptHeight / (e.Y - tableOrigin.Height));

            if (group > 1 && period > 1 && group < 20 && period < 9)
            {
                // look for element fitting desc
                foreach (PeriodicTableElement element in ElementPTFactory.Instance)
                {
                    if (element.Group.Length > 0)
                    {
                        if (group == int.Parse(element.Group) &&
                            period == int.Parse(element.Period))
                        {
                            selectedElement = element;
                            break;
                        }
                    }
                }
            }

            if (OnElementSelect != null)
                OnElementSelect(this, null);
        }
Пример #2
0
        public AtomWrapper(IAtom atom)
        {
            this.atom = atom;

            // rip some stats from the atom
            pe = (PeriodicTableElement)atom.Properties["PeriodicTableElement"];
        }
Пример #3
0
        /// <summary>  Configures an element. Finds the correct element type
        /// by looking at the element symbol.
        ///
        /// </summary>
        /// <param name="elementPT">  The element of the Periodic Table to be configure
        /// </param>
        /// <returns> element     The configured element
        /// </returns>
        public static Element configure(PeriodicTableElement elementPT)
        {
            Element element = new Element(elementPT.Symbol);

            element.Symbol       = elementPT.Symbol;
            element.AtomicNumber = elementPT.AtomicNumber;
            //element.setName(ElementInt.getName());
            //element.setChemicalSerie(ElementInt.getChemicalSerie());
            //element.setPeriod(ElementInt.getPeriod());
            //element.setGroup(ElementInt.getGroup());
            //element.setPhase(ElementInt.getPhase());
            //element.setCASid(ElementInt.getCASid());
            return(element);
        }
        /// <summary>  Configures an element. Finds the correct element type
        /// by looking at the element symbol.
        /// 
        /// </summary>
        /// <param name="elementPT">  The element of the Periodic Table to be configure
        /// </param>
        /// <returns> element     The configured element
        /// </returns>
        public static Element configure(PeriodicTableElement elementPT)
        {
            Element element = new Element(elementPT.Symbol);

            element.Symbol = elementPT.Symbol;
            element.AtomicNumber = elementPT.AtomicNumber;
            //element.setName(ElementInt.getName());
            //element.setChemicalSerie(ElementInt.getChemicalSerie());
            //element.setPeriod(ElementInt.getPeriod());
            //element.setGroup(ElementInt.getGroup());
            //element.setPhase(ElementInt.getPhase());
            //element.setCASid(ElementInt.getCASid());
            return element;
        }