Пример #1
0
 private void nodeTextBox1_DrawText(object sender, DrawTextEventArgs e)
 {
     if (e.Node.IsSelected)
     {
         e.Font = new System.Drawing.Font(e.Font, FontStyle.Bold);
     }
 }
Пример #2
0
        private void devicesTreeViewAdv_DrawNode(object sender, DrawTextEventArgs e)
        {
            e.TextColor = Color.Black;
            if (e.Node.Level == 1 || e.Node.Level == 2)
            {
                e.Font = itemFontType;
                return;
            }
            Node currentNode = (Node)e.Node.Tag;

            if (currentNode.Tag is Device.IODevice.IOChannel)
            {
                e.Font = itemFontNoDevice;

                Device.IODevice.IOChannel ch =
                    currentNode.Tag as Device.IODevice.IOChannel;
                if (!ch.IsEmpty())
                {
                    e.Font = itemFontIsDevice;
                    e.Text = ch.Name + " " + ch.Comment +
                             $" (A{ch.FullModule}:" + ch.PhysicalClamp + ")";
                }
                else
                {
                    e.Text = ch.Name + " " + ch.Comment;
                }
            }
        }
Пример #3
0
 void _nodeTextBox_DrawText(object sender, DrawTextEventArgs e)
 {
     if ((e.Node.Tag as PartNode).Text.StartsWith("Child"))
     {
         e.TextColor = Color.Red;
         // e.Font = new Font(this.Font.FontFamily, sizef, this.Font.Style);
     }
 }
Пример #4
0
 void _nodeTextBox_DrawText(object sender, DrawTextEventArgs e)
 {
     if ((e.Node.Tag as MyNode).Text.StartsWith("Child"))
     {
         e.TextColor = Color.Red;
         e.Font      = _childFont;
     }
 }
Пример #5
0
        private void _nodeIntegerTextBox_DrawText(object sender, DrawTextEventArgs e)
        {
            if ((e.Node.Tag as PartNode).Text.StartsWith("Child"))
            {
                e.TextColor = Color.Green;
                //e.Font = new Font(this.Font.FontFamily,sizef,this.Font.Style);

                //e.Context.Bounds=new Rectangle(e.Context.Bounds.X, e.Context.Bounds.Y, e.Context.Bounds.Width,60);
            }
        }
Пример #6
0
        private void importerTreeNodeName_DrawText(object sender, DrawTextEventArgs e)
        {
            ImporterNode importerNode = e.Node.Tag as ImporterNode;

            e.TextColor = Color.Black;
            if (importerNode != null && importerNode.Importer == this.defaultImporter)
            {
                e.TextColor = Color.Blue;
            }
        }
Пример #7
0
        private void NodePath_OnDrawText(object sender, DrawTextEventArgs drawTextEventArgs)
        {
            ReferenceNode node = drawTextEventArgs.Node.Tag as ReferenceNode;

            if (node == null)
            {
                return;
            }

            drawTextEventArgs.TextColor = this.PathColor;
        }
Пример #8
0
        private void NodeName_OnDrawText(object sender, DrawTextEventArgs drawTextEventArgs)
        {
            ReferenceNode node = drawTextEventArgs.Node.Tag as ReferenceNode;

            if (node == null)
            {
                return;
            }

            drawTextEventArgs.TextColor = this.objectReferenceListing.ForeColor;
        }
Пример #9
0
        private void treeNodeName_DrawText(object sender, DrawTextEventArgs e)
        {
            TypeItem item = e.Node.Tag as TypeItem;

            if (item != null && this.CanInstantiateType(item.TypeInfo))
            {
                e.TextColor = this.objectTypeView.ForeColor;
            }
            else
            {
                e.TextColor = Color.FromArgb(128, this.objectTypeView.ForeColor);
            }
        }
Пример #10
0
        private static void AlterText(DrawTextEventArgs e)
        {
            if (e.Node.Tag is MyDebugNode)
            {
                IMyExecutable executable = (e.Node.Tag as MyDebugNode).Executable;
                if (executable is MyExecutionBlock)
                {
                    e.Font = new Font(e.Font, FontStyle.Bold);
                }

                if (!executable.Enabled)
                {
                    e.TextColor = SystemColors.GrayText;
                }
            }
        }
Пример #11
0
        private void AlterBackground(DrawTextEventArgs e)
        {
            if (e.Node.IsSelected)
            {
                e.BackgroundBrush = m_selectedBrush;
            }

            var nodeData = e.Node.Tag as MyDebugNode;

            if (nodeData != null && nodeData.Breakpoint && e.Node != debugTreeView.SelectedNode)
            {
                e.BackgroundBrush = Brushes.IndianRed;
            }

            if (e.Node == m_selectedNodeView && m_selectedNodeView != debugTreeView.SelectedNode)
            {
                e.BackgroundBrush = Brushes.Gold;
            }
        }
Пример #12
0
        private void nodeTextBoxVersion_DrawText(object sender, DrawTextEventArgs e)
        {
            PackageItem packageItem = e.Node.Tag as PackageItem;

            if (packageItem != null && packageItem.PackageInfo != null && packageItem.NewestPackageInfo != null)
            {
                if (packageItem.NewestPackageInfo.Version == packageItem.PackageInfo.Version)
                {
                    e.BackgroundBrush = new SolidBrush(Color.FromArgb(32, 160, 255, 0));
                }
                else
                {
                    e.BackgroundBrush = new SolidBrush(Color.FromArgb(32, 255, 160, 0));
                }
            }
            else
            {
                e.BackgroundBrush = null;
            }
            e.TextColor = this.packageList.ForeColor;
        }
Пример #13
0
        private void profilerTimeValue_DrawText(object sender, DrawTextEventArgs e)
        {
            if (e.Node.IsSelected)
            {
                e.BackgroundBrush = m_selectedBrush;
            }

            var parentTreeNode  = e.Node.Parent;
            var parentDebugNode = parentTreeNode.Tag as MyDebugNode;

            if (parentDebugNode != null)
            {
                var parentBlock = parentDebugNode.Executable as MyExecutionBlock;
                if (parentBlock != null)
                {
                    // The parent node contains an executable block.
                    var debugNode = e.Node.Tag as MyDebugNode;

                    // Fill the time property in the view model.
                    TimeSpan profilingTime;
                    if (parentBlock.ProfilingInfo.TryGetValue(debugNode.Executable, out profilingTime))
                    {
                        debugNode.ProfilerTime = profilingTime;
                    }

                    TreeNodeAdv selectedTreeNode = GetSelectedTreeNode();
                    if (selectedTreeNode == null)
                    {
                        return;
                    }

                    // If the this node should be colored according to the time it took, use the pre-calculated color
                    // in the draw event.
                    if (parentTreeNode == selectedTreeNode)
                    {
                        e.BackgroundBrush = new SolidBrush(debugNode.BackgroundColor);
                    }
                }
            }
        }
Пример #14
0
        private void nodeTextBoxText_DrawText(object sender, DrawTextEventArgs e)
        {
            Node node = e.Node.Tag as Node;

            if (node != null)
            {
                Color color;
                if (node.IsVisible)
                {
                    SensorNode sensorNode = node as SensorNode;
                    if (plotMenuItem.Checked && sensorNode != null &&
                        sensorPlotColors.TryGetValue(sensorNode.Sensor, out color))
                    {
                        e.TextColor = color;
                    }
                }
                else
                {
                    e.TextColor = Color.DarkGray;
                }
            }
        }
Пример #15
0
        void _nodeTextBox_DrawText(object sender, DrawTextEventArgs e)
        {
            var colourNode = (e.Node.Tag as TreeNode);
            var node       = colourNode.Tag as PackEntry;

            if (node != null)
            {
                // If no value is set, get colour from the pack file.
                if (colourNode.Colour.HasValue == false)
                {
                    var colour = Color.Black;
                    if (node.IsAdded)
                    {
                        colour = Color.Green;
                    }
                    else if (node.IsRenamed)
                    {
                        colour = Color.LimeGreen;
                    }
                    else if (node.Deleted)
                    {
                        colour = Color.LightGray;
                    }
                    else if (node.Modified)
                    {
                        colour = Color.Red;
                    }

                    e.TextColor = colour;
                }
                else
                {
                    e.TextColor = colourNode.Colour.Value;
                }
            }
        }
Пример #16
0
        protected void AskToDrawText(DrawItemEventArgs e, Brush textBrush, string text, int x, int y, bool itemSelected)
        {
            Font textFont = new Font(Font, FontStyle.Bold);
            DrawTextEventArgs args = new DrawTextEventArgs();
            args.DrawItemArgs = e;
            args.SuggestedPosition = new PointF(x, y);
            args.Text = text;
            args.TextBrush = textBrush;
            args.ItemIsSelected = itemSelected;

            args.TextFont = itemSelected ? textFont : Font;

            if (DrawItemText != null)
                DrawItemText(this, args);
            else
                DrawTextDefault(args);

            textFont.Dispose();
        }
Пример #17
0
 protected static void DrawTextDefault(DrawTextEventArgs e)
 {
     e.DrawItemArgs.Graphics.DrawString(e.Text, e.TextFont, e.TextBrush, e.SuggestedPosition);
 }
Пример #18
0
 private void folderViewControlName_DrawText(object sender, DrawTextEventArgs e)
 {
     e.TextColor = Color.Black;
 }
Пример #19
0
 private void nodeTextBox_DrawText(object sender, DrawTextEventArgs e)
 {
     e.TextColor = Color.Black;
 }
Пример #20
0
 /// <summary>
 /// Событие отрисовки дерева
 /// </summary>
 /// <param name="sender">Объект вызвавший событие</param>
 /// <param name="e">Контекст переданный событием</param>
 private void modesTreeViewAdv_DrawNode(object sender, DrawTextEventArgs e)
 {
     e.TextColor = Color.Black;
 }
Пример #21
0
 private void fileTreeNodeName_DrawText(object sender, DrawTextEventArgs e)
 {
     e.TextColor = Color.FromArgb(192, Color.Black);
 }
Пример #22
0
 private void nodeTextBoxDownloads_DrawText(object sender, DrawTextEventArgs e)
 {
     e.TextColor = this.packageList.ForeColor;
 }
Пример #23
0
 private void nodeTextBox1_DrawText(object sender, DrawTextEventArgs e)
 {
     AlterText(e);
     AlterBackground(e);
 }