コード例 #1
0
        private Point DetermineEffectControlLocation(SecondaryEffect effect, int count)
        {
            Point newLocation = new Point(0, 0);
            int   offset      = 0;

            // adjust for scrolling
            if (count > 0)
            {
                offset = panelSecondaryEffects.Controls[0].Location.Y;
            }

            newLocation.Y = (effect.Height * count) + offset;

            return(newLocation);
        }
コード例 #2
0
        private void btnAddSecondaryEffect_Click(object sender, EventArgs e)
        {
            SecondaryEffect newEffectControl = new SecondaryEffect(effects);

            // Update Position
            int position = panelSecondaryEffects.Controls.Count;

            newEffectControl.Location = DetermineEffectControlLocation(newEffectControl, position);

            // Add event handler
            newEffectControl.ValuesUpdated += NewEffectControl_ValuesUpdated;

            // Add to the list
            panelSecondaryEffects.Controls.Add(newEffectControl);
        }