コード例 #1
0
ファイル: SmartFlowLayout.cs プロジェクト: PhilBusko/C-Sharp
        /// <summary>
        /// Selects the parameter thumbnail by highlighting it, triggering an event for any subscribers and
        /// scrolling to its position.
        /// </summary>
        public void SelectThumb(SmartThumbnail p_selectedThumb)
        {
            // skip new selection if it is the old selection

            if (m_selectThumbRef != null && m_selectThumbRef == p_selectedThumb)
                return;

            // select control

            this.DeselectThumb();

            if (p_selectedThumb == null)
                return;

            m_selectThumbRef = p_selectedThumb;
            m_selectThumbRef.SelectThis();

            // send event

            if (SFLEvent != null)
                SFLEvent(m_selectThumbRef);

            // scroll to position

            if (f_flowLayout.Controls.Count < 6)
                return;

            int ctrlPos = -1;

            for (int c = 0; c < f_flowLayout.Controls.Count; c++)
            {
                if (p_selectedThumb == f_flowLayout.Controls[c])
                {
                    ctrlPos = c;
                    break;
                }
            }

            if (f_flowLayout.FlowDirection == FlowDirection.TopDown)
            {
                int firstPos = f_flowLayout.Controls[0].Location.X;
                int secondPos = f_flowLayout.Controls[1].Location.X;
                int thumbLength = secondPos - firstPos;

                int scrollTo = (ctrlPos * thumbLength) - this.ClientRectangle.Width / 2;

                f_flowLayout.AutoScrollPosition = new Point(scrollTo, 0);
            }
        }
コード例 #2
0
ファイル: SmartFlowLayout.cs プロジェクト: PhilBusko/C-Sharp
        /// <summary>
        /// Creates a new thumbnail and adds it to the end of Controls.
        /// </summary>
        public void CreateThumb(string p_filePath)
        {
            SmartThumbnail createThumb = new SmartThumbnail(p_filePath, this.GetThumbnailSize());

            f_flowLayout.Controls.Add(createThumb);
        }
コード例 #3
0
ファイル: SmartFlowLayout.cs プロジェクト: PhilBusko/C-Sharp
        /// <summary>
        /// Insert the thumbnail at the requested position.
        /// </summary>
        public void InsertData(EditImageData p_data, int p_index)
        {
            try
            {
                // deselect since the inserted thumb is selected

                this.DeselectThumb();

                // create new thumb, sized for this control

                SmartThumbnail createTN = new SmartThumbnail(p_data, this.GetThumbnailSize());

                // insert the "hard way" since there is no Control.Insert

                List<SmartThumbnail> thumbList = new List<SmartThumbnail>();

                foreach (SmartThumbnail currThumb in f_flowLayout.Controls)
                    thumbList.Add(currThumb);

                f_flowLayout.Controls.Clear();

                thumbList.Insert(p_index, createTN);

                foreach (SmartThumbnail currThumb in thumbList)
                    f_flowLayout.Controls.Add(currThumb);
            }
            catch (Exception ex)
            {
                string msg = ex.Message + Utility.StringFormat.TwoEoL();
                msg += string.Format("control count: {0}, insert index {1}", this.ControlCount(), p_index);

                MessageBox.Show(msg, "InsertThumb Error");
            }
        }
コード例 #4
0
ファイル: SmartFlowLayout.cs プロジェクト: PhilBusko/C-Sharp
 /// <summary>
 /// Deselect any currently selected thumb.
 /// </summary>
 public void DeselectThumb()
 {
     if (m_selectThumbRef != null)
     {
         m_selectThumbRef.DeselectThis();
         m_selectThumbRef = null;
     }
 }
コード例 #5
0
ファイル: SmartFlowLayout.cs プロジェクト: PhilBusko/C-Sharp
        /// <summary>
        /// Creates a new thumbnail and adds it to the end of Controls.
        /// </summary>
        public void CreateThumb(EditImageData p_data)
        {
            SmartThumbnail createThumb = new SmartThumbnail(p_data, this.GetThumbnailSize());

            f_flowLayout.Controls.Add(createThumb);
        }
コード例 #6
0
ファイル: ImageWorkspace.cs プロジェクト: PhilBusko/C-Sharp
        /// <summary>
        /// Set the current SmartThumbnail reference and display it.
        /// </summary>
        public void SetCurrentThumb(SmartThumbnail currThumb)
        {
            m_thumbRef = currThumb;

            if (m_viewMode == ViewModeType.Shrink)
                m_zoomLevel = (GetZoomToShrink() < 1f ? GetZoomToShrink() : 1f);

            else if (m_viewMode == ViewModeType.Actual)
                m_zoomLevel = 1f;

            DisplayThumb();
        }
コード例 #7
0
ファイル: ImageWorkspace.cs プロジェクト: PhilBusko/C-Sharp
        public void ClearThumb()
        {
            m_thumbRef = null;

            DisplayThumb();
        }