首页 > 其他分享 >DataGridView treeview控件入门

DataGridView treeview控件入门

时间:2024-05-22 17:29:24浏览次数:10  
标签:node 控件 Color DataGridView 选中 设置 treeview

   隐藏treeview相关联的线连接 ShowLines 设置为false
    设置行高: itemHeight
    设置在窗体的位置: Dock
    设置是否随窗体大小改变而改变: Anchor
    设置被选中后,是否占满整行: FullRowSelect
    被点击后的事件: AfterSelect
private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
{
    //设置选中treeview选中背景色和前景色
    foreach(TreeNode node in treeView.Nodes)
    {
        node.BackColor = Color.White;
        node.ForeColor = Color.Black;
    }
    e.Node.BackColor = SystemColors.Highlight; 
    e.Node.ForeColor = Color.Wheat;
}

 

效果: 

 

标签:node,控件,Color,DataGridView,选中,设置,treeview
From: https://www.cnblogs.com/tlfe/p/18206773

相关文章

  • duilib 自定义控件
    1.主窗口自定义FramWnd继承WindowImplBase,重写CreateControl,HandleMessage.组合CPaintManagerUI.2.自定义控件自定义mycontrol继承CControlUI重写DoEvent,DoPaint,SetPos.main.cpp#include"FramWnd.h"intAPIENTRYWinMain(HINSTANCEhInstance,HINSTANCE/*hPrev......
  • Serilog日志输出到WPF UI控件
    使用到日志接收器的接口 ILogEventSinkWPF+Prsim+Serilog详细介绍链接 https://github.com/serilog/serilog/wiki/Developing-a-sink   publicinterfaceILogEventSinkWrite:ILogEventSink{LogEventGetLogMessage();}publicclassLogEventSink:I......
  • 自定义分页控件
    自定义分页控件tip:该控件的样式用的是materialDesign库,需要下载Nuget包CodeXaml<UserControlx:Class="TestTool.CustomControls.PagingControl"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.mic......
  • 自定义可移动点二维坐标轴控件
    自定义可移动点二维坐标轴控件目录路由参数坐标轴控件定义Demo路由参数X_YResultCollection为当前X轴对应Y轴值存储字典publicclassResultCollectionChangedEventArgs(RoutedEventroutedEvent,objectsource,IDictionary<double,double>resultCollection):Route......
  • GridLayout 等控件来完成多行按钮操作
     第一步,在布局文件中添加一个GridLayout控件,设置它的行列数和间距等属性,例如:<GridLayoutandroid:id="@+id/grid_layout"android:layout_width="match_parent"android:layout_height="wrap_content"android:columnCount="4"andr......
  • 【pywinauto】TreeViewWrapper 选择不了子元素?
    【日期】2024/5/21【问题】1、TreeViewWrapper选择不了子元素?【分析】item=tree_obj.get_item(path)item.select()select():报错,pywinauto.uia_defines.NoPatternInterfaceError无法解决click():报无对于的函数click_input():模拟鼠标移动对应控件后,再点击,缺点:如果......
  • 创建事务批量删除DataGridView数据(含关联表中的数据)
    新建一个CommandInfo.cs类usingSystem;usingSystem.Collections.Generic;usingSystem.Data.Common;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceWinStuSystem{publicclassCommandInfo{publicstringCommand......
  • C#在DataGridView表格中操作Access数据库
    C#在DataGridView表格中直接添加修改删除数据 效果图 Form1.cs完整代码usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Dat......
  • QT基础语法与控件
    1.基础使用纯正的开源版本QT使用C++来实现QT使用QT可以使C++项目可视化本身也是C++的一个库允许跨平台QT特征面向对象,模块化设计调用,所有QT控件可继承控件之间的通信,signalslot友好的联机帮助,函数参数手册自定义控件设计QTCreator编译器集成开发环境IDE直接下载QT......
  • DataGridView 批量删除 SqlServer数据
    privatevoidbuttonDelete_Click(objectsender,EventArgse){DialogResult=MessageBox.Show("确定删除这些数据么?","提示",MessageBoxButtons.YesNo);List<int>list=newList<int>();if(DialogResult==DialogResult.Yes)......