People.cs

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace RadGridViewControl
{
  public class People
  {
    public Guid Id { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }

    public string Sex { get; set; }

    public string Tel { get; set; }

    public string Address { get; set; }

    public DateTime BirthDay { get; set; }

    public string Note { get; set; }

    public string Like { get; set; }

    public string Work { get; set; }

    public List<People> Init()
    {
      var list = new List<People>();
      for (int i = 0; i < 20; i++)
      {
        var people = new People
        {
          Id = Guid.NewGuid(),
          FirstName = "王",
          LastName = "友",
          Sex = "男",
          Tel = "15209893158",
          Address = "安徽省合肥市高新区",
          BirthDay = DateTime.Now,
          Note = "大家好我是王友",
          Like = "我喜欢编程",
          Work = "其实我是一名程序员"
        };
        list.Add(people);

      }
    return list;
  }

  public DataTable Data()
  {
    DataTable dt = new DataTable();
    dt.Columns.Add("Id");
    dt.Columns.Add("FirstName");
    dt.Columns.Add("LastName");
    dt.Columns.Add("Sex");
    dt.Columns.Add("Tel");
    dt.Columns.Add("Address");
    dt.Columns.Add("BirthDay");
    dt.Columns.Add("Note");
    dt.Columns.Add("Like");
    dt.Columns.Add("Work");
    for (int i = 0; i < 20; i++)
    {
      DataRow dr = dt.NewRow();
      dr["Id"] = i;
      dr["FirstName"] = "王";
      dr["LastName"] = "友"+i;
      dr["Sex"] = "男";
      dr["Tel"] = "1520989315"+i;
      dr["Address"] = "安徽省合肥市高新区";
      dr["BirthDay"] = DateTime.Now.AddDays(i);
      dr["Note"] = "大家好我是王友"+i;
      dr["Like"] = "我喜欢编程";
      dr["Work"] = "其实我是一名程序员";
      dt.Rows.Add(dr);
    }
    return dt;
    }
  }
}

RadGridViewUserControl.cs

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.Data;
using Telerik.WinControls.UI;
using Telerik.WinControls.UI.Localization;
using System.Xml;

namespace RadGridViewControl
{
  public partial class RadGridViewUserControl : UserControl
  {
    /// <summary>
    /// 数据源
    /// </summary>
    public DataTable Data;

    private DataTable DataTableList { get; set; }

    /// <summary>
    /// 构造函数
    /// </summary>
    public RadGridViewUserControl()
    {
      InitializeComponent();
    }

    /// <summary>
    /// 构造函数2
    /// </summary>
    /// <param name="xmlName">xml文件路径+名称</param>
    public RadGridViewUserControl(string xmlName)
    {
      InitializeComponent();
      _xmlName = xmlName;
    }

    #region 定义的接口

    /// <summary>
    /// 定义xml文件
    /// </summary>
    public string Xml { get; set; }

    /// <summary>
    /// xml文件路径+名称
    /// </summary>
    public List<SelectColumn> ReadXml()
    {
      List<SelectColumn> selectColumns = new List<SelectColumn>();
      XmlDataDocument doc = new XmlDataDocument();
      try
      {
        doc.Load(Xml);

        XmlNode dataTableSettingsNode = doc.SelectSingleNode("DataTable_Settings");//根结点
        XmlNode dataCellsNode = dataTableSettingsNode.SelectSingleNode("data_cells");
        if (null == dataCellsNode) return null;
        XmlNodeList dataCellNode = dataCellsNode.SelectNodes("data_cell");

        foreach (XmlNode node in dataCellNode)
        {
          SelectColumn selectColumn = new SelectColumn();
          selectColumn.ColumnName = node.SelectSingleNode("cell_name").InnerText;
          selectColumn.ChineseColumnName = node.SelectSingleNode("chinese_name").InnerText;
          selectColumn.IsVisible = bool.Parse(node.SelectSingleNode("visible").InnerText);
          selectColumn.Width = int.Parse(node.SelectSingleNode("width").InnerText);
          selectColumn.Align = int.Parse(node.SelectSingleNode("align").InnerText);
          selectColumn.ShowIndex = int.Parse(node.SelectSingleNode("show_index").InnerText);
          selectColumns.Add(selectColumn);
        }
      }
    catch (Exception ex)
    {

    }
    return selectColumns;
  }

  /// <summary>
  /// 获取选中的数据
  /// </summary>
  /// <param name="indexList">获取选中的行</param>
  /// <returns></returns>
  public List<GridViewRowInfo> GetSelData(ref List<string> indexList)
  {
    var listRows = new List<GridViewRowInfo>();
    foreach (var row in rgv_Control.Rows)
    {
      var value = row.Cells["ChkSelect"].Value.ToString();
      var index = row.Cells["Num"].Value.ToString();
      if (!value.Equals("True")) continue;
      indexList.Add(index);
      listRows.Add(row);
    }
    return listRows;
  }

  /// <summary>
  /// 初始化用户控件
  /// </summary>
  public void RadGridViewControl_Init(DataTable dataTable)
  {
    DataTableList = dataTable;
    SetRadGridViewProperty();
    AddTwoColumn();
    BindRadGridViewControl(dataTable);
    WrapText();
    SetColumnReadOnly();

    RadGridLocalizationProvider.CurrentProvider = new ChineseRadGridLocalizationProvider();
    rgv_Control.Rows.CollectionChanged += Rows_CollectionChanged;
    SetRadGridViewForXml();
  }

  /// <summary>
  /// 通过XML设置RadGridView控件
  /// </summary>
  private void SetRadGridViewForXml()
  {
    var list = ReadXml();
    SetColumnWidth(list);
    ConvertColumnNameToChinese(list);
    ShowColumnName(list);
    SetColumnAlign(list);
    ShowColumnIndex(list);
  }

  /// <summary>
  /// 获取拖动后的数据记录
  /// </summary>
  /// <returns></returns>
  public DataTable GetAllGridViewData()
  {
    var dt = new DataTable();
    foreach (var column in rgv_Control.Columns)
    {
      var dataColumn = new DataColumn
      {
        ColumnName = column.Name
      };
      if (!(column.Name.Equals("Num") || column.Name.Equals("ChkSelect")))
      {
        dt.Columns.Add(dataColumn);
      }
    }
    foreach (GridViewRowInfo t in rgv_Control.Rows)
    {
      var datarow = dt.NewRow();
      for (var j = 0; j < dt.Columns.Count; j++)
      {
        datarow[dt.Columns[j].ColumnName] = t.Cells[dt.Columns[j].ColumnName].Value;
      }
      dt.Rows.Add(datarow);
    }
    return dt;
    }

  /// <summary>
  /// 获取按钮的句柄
  /// </summary>
  /// <returns></returns>
  public IntPtr getBtHandler()
  {
    return this.btn_Select.Handle;
  }
  #endregion

  /// <summary>
  /// 如果像这样写分组的话那我要累死
  /// </summary>
  public bool EnableGrouping
  {
    get { return rgv_Control.EnableGrouping; }
    set { rgv_Control.EnableGrouping = value; }
  }

  /// <summary>
  /// 设置RadGridView控件属性
  /// </summary>
  private void SetRadGridViewProperty()
  {
    rgv_Control.EnableGrouping = false;//去掉分组
    rgv_Control.AllowDrop = true;
    rgv_Control.AllowRowReorder = true;
    rgv_Control.AddNewRowPosition = SystemRowPosition.Bottom;
    rgv_Control.ShowRowHeaderColumn = false;
    rgv_Control.AutoSizeRows = true;
    rgv_Control.AllowAddNewRow = false;
  }

  /// <summary>
  /// 添加两个特殊列
  /// </summary>
  private void AddTwoColumn()
  {
    var numColumn = new GridViewDecimalColumn(typeof(int), "Num", "Num")
    {
      HeaderText = "序 号",
      Width = 50,
      ReadOnly = true,
      IsPinned = true
    };
    rgv_Control.Columns.Add(numColumn);

    var chkColumn = new GridViewCheckBoxColumn("ChkSelect", "ChkSelect")
    {
      HeaderText = "选 择",
      Width = 50,
      IsPinned = true
    };
    rgv_Control.Columns.Add(chkColumn);
  }

  /// <summary>
  /// 设置表格只读
  /// </summary>
  private void SetColumnReadOnly()
  {
    for (var i = 0; i < rgv_Control.Columns.Count; i++)
    {
      rgv_Control.Columns[i].ReadOnly = true;
    }
    rgv_Control.Columns["ChkSelect"].ReadOnly = false;
  }

  /// <summary>
  /// 显示列顺序
  /// </summary>
  /// <param name="list"></param>
  private void ShowColumnIndex(IEnumerable<SelectColumn> list)
  {
    foreach (var i in list)
    {
      SelectColumn selectColumn = i;
      foreach (var column in rgv_Control.Columns.Where(column => !column.Name.Equals("Num") && !column.Name.Equals("ChkSelect")).Where(column => selectColumn.ColumnName.Equals(column.Name)))
      {
        var oldIndex = column.Index;
        var newIndex = i.ShowIndex;
        if (oldIndex > newIndex)
        {
          rgv_Control.Columns.Move(oldIndex, newIndex);
          rgv_Control.Columns.Move(newIndex + 1, oldIndex);
        }
        else if (oldIndex < newIndex)
        {
          rgv_Control.Columns.Move(oldIndex, newIndex);
          rgv_Control.Columns.Move(newIndex - 1, oldIndex);
        }
        break;
      }
    }
  }

  /// <summary>
  /// 设置列宽度
  /// </summary>
  private void SetColumnWidth(IEnumerable<SelectColumn> list)
  {
    foreach (var i in list)
    {
      rgv_Control.Columns[i.ColumnName].Width = i.Width;
    }
  }

  /// <summary>
  /// 将列名转化成中文
  /// </summary>
  public void ConvertColumnNameToChinese(List<SelectColumn> list)
  {
    foreach (var i in list)
    {
      rgv_Control.Columns[i.ColumnName].HeaderText = i.ChineseColumnName;
    }
  }

  /// <summary>
  /// Data中,是否显示列名称
  /// </summary>
  public void ShowColumnName(List<SelectColumn> list)
  {
    foreach (var i in list)
    {
      rgv_Control.Columns[i.ColumnName].IsVisible = i.IsVisible;
    }
  }

  /// <summary>
  /// 设置列对齐
  /// </summary>
  public void SetColumnAlign(List<SelectColumn> list)
  {
    foreach (var i in list)
    {
      switch (i.Align)
      {
        case 0:
        rgv_Control.Columns[i.ColumnName].TextAlignment = ContentAlignment.MiddleCenter;
        break;
        case 1:
        rgv_Control.Columns[i.ColumnName].TextAlignment = ContentAlignment.MiddleLeft;
        break;
        case 3:
        rgv_Control.Columns[i.ColumnName].TextAlignment = ContentAlignment.MiddleRight;
        break;
        default:
        break;
      }
    }
  }

  /// <summary>
  /// 点击列选择按钮
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void btn_Select_Click(object sender, EventArgs e)
  {
    var selectColumnForm = new SelectColumnForm(Xml);
    selectColumnForm.ShowDialog();
    if (selectColumnForm.DialogResult == DialogResult.OK)
    {
      SetRadGridViewForXml();
    }
  }

  /// <summary>
  /// 设置右键菜单
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void rgv_Control_ContextMenuOpening(object sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
  {
    for (var i = 0; i < e.ContextMenu.Items.Count; i++)
    {
      var contextMenuText = e.ContextMenu.Items[i].Text;

      switch (contextMenuText)
      {
        case "条件格式":
        e.ContextMenu.Items[i].Visibility = ElementVisibility.Collapsed;
        e.ContextMenu.Items[i + 1].Visibility = ElementVisibility.Collapsed;
        break;
        case "隐 藏":
        e.ContextMenu.Items[i].Visibility = ElementVisibility.Collapsed;
        break;
        case "锁定状态":
        e.ContextMenu.Items[i].Visibility = ElementVisibility.Collapsed;
        break;
        case "自适应列宽":
        e.ContextMenu.Items[i].Visibility = ElementVisibility.Collapsed;
        break;
        case "列选择":
        e.ContextMenu.Items[i].Visibility = ElementVisibility.Collapsed;
        break;
      }
    }
  }

  /// <summary>
  /// 设置换行
  /// </summary>
  public void WrapText()
  {
    foreach (var obj in rgv_Control.Columns)
    {
      obj.WrapText = true;
    }
  }

  /// <summary>
  /// RadGridView控件绑定数据
  /// </summary>
  /// <param name="dt"></param>
  public void BindRadGridViewControl(DataTable dt)
  {
    var num = 0;
    foreach (var newColumn in from object column in dt.Columns select new GridViewTextBoxColumn(column.ToString(), column.ToString()))
    {
      rgv_Control.Columns.Add(newColumn);
    }
    for (var i = 0; i < dt.Rows.Count; i++)
    {
      var cellcount = 0;
      var listRow = new object[dt.Rows.Count + 2];
      listRow[cellcount++] = ++num;
      listRow[cellcount++] = false;
      for (var j = 0; j < dt.Columns.Count; j++)
      {
        listRow[cellcount++] = dt.Rows[i][j];
      }
      rgv_Control.Rows.Add(listRow);
    }
  }

  /// <summary>
  ///
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void Rows_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
  {
    if (e.Action != NotifyCollectionChangedAction.Move) return;
    for (var i = 0; i < rgv_Control.Rows.Count; i++)
    {
      rgv_Control.Rows[i].Cells["Num"].Value = i + 1;
    }
  }

  /// <summary>
  /// 测试数据1
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void btn_Data_Click(object sender, EventArgs e)
  {
    var rowIndexList = new List<string>();
    var rows = GetSelData(ref rowIndexList);//测试GetSelData方法
  }

  /// <summary>
  /// 测试数据2
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void btn_GetAllData_Click(object sender, EventArgs e)
  {
    var dt = GetAllGridViewData();//测试GetAllGridViewData方法
  }

  }
}

SelectColumnForm.cs

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Telerik.WinControls.Data;
using Telerik.WinControls.UI;
using System.Xml;

namespace RadGridViewControl
{
  public partial class SelectColumnForm : Form
  {
  /// <summary>
  /// 定义xml文件
  /// </summary>
  public string Xml { get; set; }

  public SelectColumnForm()
  {
    InitializeComponent();
  }

  public SelectColumnForm(string xml)
  {
    InitializeComponent();
    Xml = xml;
    AddColumns();
    SetRadGridViewProperty();
    var list = ReadXml();
    AddRows(list);
    rgv_SelectColumn.Rows.CollectionChanged += Rows_CollectionChanged;
  }

  /// <summary>
  /// 获取拖动后的数据记录
  /// </summary>
  /// <returns></returns>
  public DataTable GetAllGridViewData()
  {
    var dt = new DataTable();
    foreach (var column in rgv_SelectColumn.Columns)
    {
      var dataColumn = new DataColumn
      {
        ColumnName = column.Name
      };
      dt.Columns.Add(dataColumn);
    }
    foreach (GridViewRowInfo t in rgv_SelectColumn.Rows)
    {
      var datarow = dt.NewRow();
      for (var j = 0; j < dt.Columns.Count; j++)
      {
        datarow[dt.Columns[j].ColumnName] = t.Cells[dt.Columns[j].ColumnName].Value;
      }
      dt.Rows.Add(datarow);
    }
    return dt;
  }

  /// <summary>
  /// 修改xml文件
  /// </summary>
  /// <param name="dt"></param>
  private void ModifyXml(DataTable dt)
  {
    XmlDataDocument doc = new XmlDataDocument();
    try
    {
      doc.Load(Xml);
      XmlNode dataTableSettingsNode = doc.SelectSingleNode("DataTable_Settings");//根结点
      XmlNode dataCellsNode = dataTableSettingsNode.SelectSingleNode("data_cells");
      if (null == dataCellsNode) return;
      XmlNodeList dataCellNode = dataCellsNode.SelectNodes("data_cell");

      foreach (XmlNode node in dataCellNode)
      {
        var chinesename = node.SelectSingleNode("chinese_name").InnerText;
        var row = SearchRows(chinesename, dt);
        node.SelectSingleNode("show_index").InnerText = (int.Parse(row[0].ToString()) + 1).ToString();
        node.SelectSingleNode("visible").InnerText = row[1].ToString();
        node.SelectSingleNode("width").InnerText = row[3].ToString();
        switch (row[4].ToString())
        {
          case "左对齐":
          node.SelectSingleNode("align").InnerText = "1";
          break;
          case "右对齐":
          node.SelectSingleNode("align").InnerText = "2";
          break;
          case "居中对齐":
          node.SelectSingleNode("align").InnerText = "0";
          break;
          default: break;
          }
        }
      doc.Save(Xml);
    }
    catch (Exception ex)
    {

    }
  }

  private object[] SearchRows(string rowname, DataTable dt)
  {
    foreach (DataRow row in dt.Rows)
    {
      if (row["colname"].ToString() == rowname)
      {
        return row.ItemArray;
      }
    }
    return null;
  }

  /// <summary>
  /// 添加数据行
  /// </summary>
  /// <param name="list"></param>
  private void AddRows(List<SelectColumn> list)
  {
    var count = 0;
    var linqList = (from column in list
            orderby column.ShowIndex
            select column).ToList();
    foreach (var selectColumn in linqList)
    {
      var obj = new object[list.Count];
      obj[0] = ++count;
      obj[1] = selectColumn.IsVisible;
      obj[2] = selectColumn.ChineseColumnName;
      obj[3] = selectColumn.Width;
      switch (selectColumn.Align)
      {
        case 0:
        obj[4] = "居中对齐";
        break;
        case 1:
        obj[4] = "左对齐";
        break;
        case 2:
        obj[4] = "右对齐";
        break;
      }
      rgv_SelectColumn.Rows.Add(obj);
      }
    }

  private void btn_Ok_Click(object sender, EventArgs e)
  {
    var dt = GetAllGridViewData();
    ModifyXml(dt);
    DialogResult=DialogResult.OK;
    Close();
  }

  /// <summary>
  /// 添加数据列
  /// </summary>
  private void AddColumns()
  {
    var num = new GridViewTextBoxColumn("Num", "Num");
    num.HeaderText = "序 号";
    num.ReadOnly = true;
    num.Width = 50;
    num.WrapText = false;
    num.TextAlignment = ContentAlignment.MiddleCenter;

    var chk = new GridViewCheckBoxColumn("Chk", "Chk");
    chk.HeaderText = "选 择";
    chk.ReadOnly = false;
    chk.Width = 50;
    chk.WrapText = false;

    var colname = new GridViewTextBoxColumn("colname", "colname");
    colname.HeaderText = "列 名";
    colname.ReadOnly = true;
    colname.Width = 100;
    colname.WrapText = false;
    colname.TextAlignment = ContentAlignment.MiddleCenter;

    var colwidth = new GridViewDecimalColumn("colwidth", "colwidth");
    colwidth.HeaderText = "列 宽";
    colwidth.ReadOnly = false;
    colwidth.DataType = typeof(int);
    colwidth.Width = 80; ;
    colwidth.WrapText = false;
    colwidth.TextAlignment = ContentAlignment.MiddleCenter;
    colwidth.FormatString = "{0:d}";

    var colalign = new GridViewComboBoxColumn("colalign", "colalign");
    colalign.HeaderText = "对齐方式";
    colalign.DataSource = new[] { "左对齐", "居中对齐", "右对齐" };
    colalign.Width = 100;
    colalign.WrapText = false;
    colalign.TextAlignment = ContentAlignment.MiddleCenter;

    rgv_SelectColumn.Columns.Add(num);
    rgv_SelectColumn.Columns.Add(chk);
    rgv_SelectColumn.Columns.Add(colname);
    rgv_SelectColumn.Columns.Add(colwidth);
    rgv_SelectColumn.Columns.Add(colalign);
  }

  /// <summary>
  /// 设置RadGridView控件属性
  /// </summary>
  private void SetRadGridViewProperty()
  {
    rgv_SelectColumn.EnableGrouping = false;//去掉分组
    rgv_SelectColumn.AllowDrop = true;
    rgv_SelectColumn.AllowRowReorder = true;
    rgv_SelectColumn.AddNewRowPosition = SystemRowPosition.Bottom;
    rgv_SelectColumn.ShowRowHeaderColumn = false;
    rgv_SelectColumn.AllowColumnHeaderContextMenu = false;
    rgv_SelectColumn.AllowColumnResize = false;
    rgv_SelectColumn.AllowColumnReorder = false;
    rgv_SelectColumn.EnableSorting = false;
    rgv_SelectColumn.AllowAddNewRow = false;
    rgv_SelectColumn.AllowRowResize = false;
  }

  /// <summary>
  /// xml文件路径+名称
  /// </summary>
  public List<SelectColumn> ReadXml()
  {
    List<SelectColumn> selectColumns = new List<SelectColumn>();
    XmlDataDocument doc = new XmlDataDocument();
    try
    {

      doc.Load(Xml);

      XmlNode dataTableSettingsNode = doc.SelectSingleNode("DataTable_Settings");//根结点
      XmlNode dataCellsNode = dataTableSettingsNode.SelectSingleNode("data_cells");
      if (null == dataCellsNode) return null;
      XmlNodeList dataCellNode = dataCellsNode.SelectNodes("data_cell");

      foreach (XmlNode node in dataCellNode)
      {
        SelectColumn selectColumn = new SelectColumn();
        selectColumn.ColumnName = node.SelectSingleNode("cell_name").InnerText;
        selectColumn.ChineseColumnName = node.SelectSingleNode("chinese_name").InnerText;
        selectColumn.IsVisible = bool.Parse(node.SelectSingleNode("visible").InnerText);
        selectColumn.Width = int.Parse(node.SelectSingleNode("width").InnerText);
        selectColumn.Align = int.Parse(node.SelectSingleNode("align").InnerText);
        selectColumn.ShowIndex = int.Parse(node.SelectSingleNode("show_index").InnerText);
        selectColumns.Add(selectColumn);
        }
      }
    catch (Exception ex)
    {

    }
    return selectColumns;
  }

  /// <summary>
  /// 行拖动时控件序号的显示
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void Rows_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
  {
    if (e.Action != NotifyCollectionChangedAction.Move) return;
    for (var i = 0; i < rgv_SelectColumn.Rows.Count; i++)
    {
      rgv_SelectColumn.Rows[i].Cells["Num"].Value = i + 1;
    }
    }

  }
}

Telerik 控件事例(鼠标拖动行,拖动列,设置行对齐,行宽,是否显示)的更多相关文章

  1. C#设置一个控件可以鼠标拖动

    C#设置一个控件可以鼠标拖动: 新建一个C#项目, 创建一个label控件, 设置label的鼠标按下和抬起事件分别为:label1_MouseDown和label1_MouseUp. 对代码进行如下 ...

  2. WPF ItemsControl 控件支持鼠标滚轮滑动

    此文章意在解决在WPF中ItemsControl类型的集合控件支持鼠标滚轮操作,并可控制滚动的速度. 第一步:给ItemsControl添加滚轮事件. this.listBox.AddHandler( ...

  3. WinFrom 第三方控件 TeleRik控件

    1.首先从工具-拓展与应用中下载安装  TeleRik WinFroms VsExtensions   TeleRik dll文件     2.工具箱控件  将Telerik控件更新过来 3.新建一个 ...

  4. WPF 在image控件用鼠标拖拽出矩形

    原文:WPF 在image控件用鼠标拖拽出矩形 版权声明:博客已迁移到 http://lindexi.gitee.io 欢迎访问.如果当前博客图片看不到,请到 http://lindexi.gitee ...

  5. 2018-11-19-WPF-在image控件用鼠标拖拽出矩形

    title author date CreateTime categories WPF 在image控件用鼠标拖拽出矩形 lindexi 2018-11-19 15:35:13 +0800 2018- ...

  6. word-wrap&&word-break,奇偶行、列设置样式

    1.word-wrap和word-break区分. 来源场景:机械租赁mvc驾驶员信息查看: 当备注的文字多的时候,第一列的值成这模样: 解决方案:设置table 的td可自动换行.首先table设置 ...

  7. Python+Appium自动化测试(10)-TouchAction类与MultiAction类(控件元素的滑动、拖动,九宫格解锁,手势操作等)

    滑动屏幕方法swipe一般用于对页面进行上下左右滑动操作,但自动化过程中还会遇到其他情况,如对控件元素进行滑动.拖拽操作,九宫格解锁,手势操作,地图的放大与缩小等.这些需要针对控件元素的滑动操作,或者 ...

  8. 使用Telerik控件搭建Doubanfm频道部分

    今天感觉好累啊..还是坚持记录下. 收集的API: https://github.com/HakurouKen/douban.fm-api https://github.com/zonyitoo/do ...

  9. winform Chart控件 获取鼠标处坐标值方法

    Chart控件本身功能强大,应用广泛,因此其属性.方法也很多.此处介绍在很多应用中需要查看鼠标位置处坐标值的一些方法 1,调用Chart事件  GetToolTip 利用ToolTipEventArg ...

随机推荐

  1. (转载)Java NIO:NIO原理分析(二)

          NIO中的两个核心对象:缓冲区和通道,在谈到缓冲区时,我们说缓冲区对象本质上是一个数组,但它其实是一个特殊的数组,缓冲区对象内置了一些机制,能够跟踪和记录缓冲区的状态变化情况,如果我们使用 ...

  2. 本机连接虚拟机Oracle时报错的解决办法

    虚拟机安装了Oracle服务器(桌面类)和客户端,里面使用plsql连接自己没有问题. 在本机连接虚拟机没有成功.虚拟机的地址是192.168.126.132,已经确认本机能ping通虚拟机. 先是报 ...

  3. IIS 发布网站到外网

    前段时间做了一个项目在局域网中测试后要发布到外网上,一时间不知怎么搞,以为直接在IIS中修改发布时的IP就可以了,但是不可行,经过摸索终于成功发布到外网,下面是具体步骤. 前期准备:公网IP,掩码,网 ...

  4. MyBatis(3.2.3) - Handling the CLOB/BLOB types

    MyBatis provides built-in support for mapping CLOB/BLOB type columns. Assume we have the following t ...

  5. 每天一道LeetCode--169.Majority Elemen

    Given an array of size n, find the majority element. The majority element is the element that appear ...

  6. 和阿文一起学H5-文字云制作

    ---恢复内容开始--- 实用工具!优秀的标签云免费生成工具 来源:http://www.uisdc.com/online-word-cloud-generators 标签云或文字云是关键词的视觉化描 ...

  7. SQL Server的三种物理连接之Loop Join(一)

    Sql Server有三种物理连接Loop Join,Merge Join,Hash Join, 当表之间连接的时候会选择其中之一,不同的连接产生的性能不同,理解这三种物理连接对性能调优有很大帮助. ...

  8. JqGrid在IE8中表头不能分组的解决办法

    修改JqGrid的js脚本: for (d = 0; d < c; d++) { if (b[d] != undefined) { //主要是添加这个判断 if (b[d].startColum ...

  9. 关于HTML与CSS编写规范

    之前一直没有注意到这一点,因为当看到一些优秀的网站的源代码的时候,打开他们引用的css文件格式看起来也并非规范.但幸运的昨天偶然间看到的通过增强CSS规范可读性可优化页面性能,于是下决心痛改前非. 我 ...

  10. Java权限讲解

    Java访问权限就如同类和对象一样,在Java程序中随处可见. Java的访问权限,根据权限范围从大到小为:public > protected > package > privat ...