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. Guava: 事件总线EventBus

    EventBus 直译过来就是事件总线,它使用发布订阅模式支持组件之间的通信,不需要显式地注册回调,比观察者模式更灵活,可用于替换Java中传统的事件监听模式,EventBus的作用就是解耦,它不是通 ...

  2. UpdatePanel中执行js

    在UpdatePanel中,直接使用Page.ClientScript.RegisterStartupScript的方式执行javascript,会导致无法执行.原因可能是因为RegisterStar ...

  3. 分享我的2014年3月unity3d面试题与参考答案

    今年3月份面试unity3d游戏程序,先做的面试题,然后人事问了我几个之前游戏开发的问题,问我英语怎么样等等,介绍了公司情况和对unity3d程序的要求.之后就回来了,总共面了不到1个半小时吧.笔试答 ...

  4. ActionBar 的简单使用

    About ActionBar The action bar is one of the most important design elements you can implement for yo ...

  5. Animated App Boot Example : Fastest animation at app boot time

    This iPhone app shows how to create an animation that is displayed when the app starts. The animatio ...

  6. hiho 1182 : 欧拉路·三

    1182 : 欧拉路·三 这时题目中给的提示: 小Ho:是这样的,每次转动一个区域不是相当于原来数字去掉最左边一位,并在最后加上1或者0么. 于是我考虑对于"XYYY",它转动之后 ...

  7. SQL server 2008 安装问题解决

    安装sqlserver2008 出现的一些问题解决方法 1,安装sqlserver的时候出现如下图所示,解决办法是:开始→运行→输入“regedit”→找到“HKEY_LOCAL_MACHINE\SY ...

  8. PHP学习笔记--入门篇

    PHP学习笔记--入门篇 一.Echo语句 1.格式 echo是PHP中的输出语句,可以把字符串输出(字符串用双引号括起来) 如下代码 <?php echo "Hello world! ...

  9. wampserver安装后 mysql 所有数据库丢失的解决方案

    事情起源: 晚上十点客户紧急来电,说是网站全部瘫痪.同事登陆数据库一看,Mysql Workbench Database下一片空白.当时我们都傻了. 发现原因: 服务器环境是windows serve ...

  10. easyloader [easyui_1.4.2] 分析源码,妙手偶得之

    用easyui很久了,但是很少去看源码. 有解决不了的问题就去百度... 今日发现,easyui的源码不难懂. 而且结合 easyloader 可以非常方便的逐个研究easyui的组件. 但是, ea ...