Beispiel #1
0
        public ExRichTextBox()
        {
            windowExtender = new WindowExtender(this);
            windowExtender.AssignHandle(Handle);

            SelectionTabs      = ArrayFunctions.array(32, 64, 96, 128, 160, 192, 224);
            leftMargin         = 0;
            modificationStates = new List <ModificationState>();

            TextChanged += (_, _) =>
            {
                if (!ModificationLocked)
                {
                    var lineCount = Lines.Length;
                    if (lineCount > 0)
                    {
                        if (modificationStates.Count < lineCount)
                        {
                            while (modificationStates.Count < CurrentLineNumber)
                            {
                                modificationStates.Add(ModificationState.Unmodified);
                            }

                            while (modificationStates.Count < lineCount)
                            {
                                modificationStates.Insert(CurrentLineNumber, ModificationState.Unmodified);
                            }
                        }
                        else
                        {
                            while (modificationStates.Count > lineCount)
                            {
                                modificationStates.RemoveAt(CurrentLineNumber);
                            }
                        }

                        if (CurrentLineNumber.Between(0).Until(modificationStates.Count))
                        {
                            modificationStates[CurrentLineNumber] = ModificationState.Modified;
                        }
                    }
                }

                LineChanged?.Invoke(this, new LineChangedEventArgs(CurrentLineNumber));
            };
        }
 private void OnLineChanged(object sender, MixerEventArgs e)
 {
   LineChanged?.Invoke(sender, e);
 }
Beispiel #3
0
 protected virtual void OnLineChanged() => LineChanged?.Invoke();