LabelPlus.PicView.SetLabelVisual C# (CSharp) Method

SetLabelVisual() public method

public SetLabelVisual ( int index ) : void
index int
return void
        public void SetLabelVisual(int index)
        {
            if (index < labels.Count) {
                float x = labels[index].X_percent * image.Size.Width;
                float y = labels[index].Y_percent * image.Size.Height;
                float startX = x - clientRect.Width * GlobalVar.SetLabelVisualRatioX;
                float startY = y - clientRect.Height * GlobalVar.SetLabelVisualRatioY;

                //startX Y转换到原始尺寸坐标
                float ratio = (float)image.Size.Width / imageOriginal.Size.Width;
                startX = startX / ratio;
                startY = startY / ratio;

                StartP = new PointF(startX,startY);
                MakeImageNow();
            }
        }

Usage Example

Ejemplo n.º 1
0
        private void listViewSelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (listviewapt.SelectedIndex == -1)
                {
                    //did not select item
                    setTextboxText("");
                    itemIndex            = -1;
                    textboxgroupbox.Text = "";
                }
                else
                {
                    itemIndex = listviewapt.SelectedIndex;
                    setTextboxText(wsp.Store[fileName][itemIndex].Text);
                    textboxgroupbox.Text = (itemIndex + 1).ToString();

                    if (workMode == WorkMode.Input)
                    {
                        if (picview.Focused)
                        {
                            return;
                        }
                        if (listviewapt.SelectedIndexCount > 1)
                        {
                            return;
                        }
                        picview.SetLabelVisual(listviewapt.SelectedIndex);
                    }
                    else if (workMode == WorkMode.Check)
                    {
                        if (listviewapt.SelectedIndexCount > 1)
                        {
                            return;
                        }

                        if (listviewapt.ListView.Focused == true)
                        {
                            picview.SetLabelVisual(listviewapt.SelectedIndex);
                        }
                    }
                }
            }
            catch { }
        }