Ejemplo n.º 1
0
        private void InitSnapContextMenuAndExpoTimeRange()
        {
            if (toupcam_ == null)
            {
                return;
            }

            uint nMin = 0, nMax = 0, nDef = 0;

            if (toupcam_.get_ExpTimeRange(out nMin, out nMax, out nDef))
            {
                trackBar1.SetRange((int)nMin, (int)nMax);
            }
            OnEventExposure();

            if (toupcam_.StillResolutionNumber <= 0)
            {
                return;
            }

            button2.ContextMenuStrip              = new ContextMenuStrip();
            button2.ContextMenuStrip.ItemClicked += new ToolStripItemClickedEventHandler(this.SnapClickedHandler);

            if (toupcam_.StillResolutionNumber < toupcam_.ResolutionNumber)
            {
                uint eSize = 0;
                if (toupcam_.get_eSize(out eSize))
                {
                    if (0 == eSize)
                    {
                        StringBuilder sb = new StringBuilder();
                        int           w = 0, h = 0;
                        toupcam_.get_Resolution(eSize, out w, out h);
                        sb.Append(w);
                        sb.Append(" * ");
                        sb.Append(h);
                        button2.ContextMenuStrip.Items.Add(sb.ToString());
                        return;
                    }
                }
            }

            for (uint i = 0; i < toupcam_.ResolutionNumber; ++i)
            {
                StringBuilder sb = new StringBuilder();
                int           w = 0, h = 0;
                toupcam_.get_Resolution(i, out w, out h);
                sb.Append(w);
                sb.Append(" * ");
                sb.Append(h);
                button2.ContextMenuStrip.Items.Add(sb.ToString());
            }
        }