Ejemplo n.º 1
0
        private void Redraw(Graphics graphics)
        {
            if (note != null)
            {
                int xWidth   = MeasureText(graphics, "x", Font);
                int sepWidth = 2 * xWidth;

                int x = 0, y = 0;

                StartLine(graphics, y);
                for (int i = 0; i < ValueInfo.Values.Length; i++)
                {
                    ValueInfo valueInfo = ValueInfo.Values[i];

                    if (valueInfo == null)
                    {
                        if (y == 0)
                        {
                            FinishLine(graphics, ref x, ref y);
                            StartLine(graphics, y);
                        }
                        continue;
                    }

                    string value        = valueInfo.GetValue(Note);
                    string defaultValue = valueInfo.GetDefaultValue();

                    bool editing = currentFieldValueInfo == valueInfo;

                    AddText(
                        graphics,
                        valueInfo.Tag,
                        !editing ? value : textEditControl.Text,        // value text
                        editing || !String.Equals(value, defaultValue), // bold
                        !editing && (highlightedItem == i),             // highlight
                        ref x,
                        ref y,
                        out rectsFieldBounds[i],
                        out rectsFieldEditableBounds[i]);

                    if (valueInfo.SpacerFollows)
                    {
                        x += sepWidth;
                    }
                }
                FinishLine(graphics, ref x, ref y);

                MinimumSize = new Size(MinimumSize.Width, y);
            }
            else
            {
                graphics.FillRectangle(backBrush, ClientRectangle);
            }
        }
Ejemplo n.º 2
0
        private void CommitFieldEdit(ValueInfo valueInfo)
        {
            int index = Array.IndexOf(ValueInfo.Values, valueInfo);

            Debug.Assert(index >= 0);

            if (Note != null)
            {
                if (!String.Equals(textEditControl.Text, valueInfo.GetValue(Note)))
                {
                    undoHelper.SaveUndoInfo(false /*forRedo*/, "Change Note Property");
                    valueInfo.SetValue(Note, textEditControl.Text);
                }
            }

            textEditControl.Visible = false;
            currentFieldValueInfo   = null;
            Invalidate();
        }
Ejemplo n.º 3
0
        private string GetValue(NoteNoteObjectRec note, InlineParamVis param)
        {
            ValueInfo valueInfo = ValueInfo.FindInlineParamVis(param);

            return(valueInfo.GetValue(note));
        }