excel改的日期格式为啥要双击一下单元格才能变

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了excel改的日期格式为啥要双击一下单元格才能变相关的知识,希望对你有一定的参考价值。

本来设计的命令就这样:
单击是选中,双击是编辑状态。

因为如果单击就进入编辑状态,很容易导致对表格中的数据进行误操作。
参考技术A 你直接选中要改变格式的单元格,右键,设置单元格格式,数字,分类,里面选中日期,选你需要的格式即可! 参考技术B 回答

1、在圈选区域后使用快捷键ALT+=即可进行一键求和。2、圈选需要隐藏的行按快捷键CTRL+9即可快速隐藏,按CTRL+SHIFT+9即可取消隐藏。3、在数值混乱的时候点击右上方的排序和筛选,即可对数据进行升序降序的排序。4、在右上方的排序和筛选中开筛选功能,即可在列表中筛选出需要的数据。

C# 如何将ListView的单元格双击之后可以编辑

参考技术A using System;
using System.Drawing;
using System.Windows.Forms;
namespace WinFormListviewAddContrl

//msg=0x115 (WM_VSCROLL)
//msg=0x114 (WM_HSCROLL)
/// <summary>
/// CListView 的摘要说明。
/// </summary>
public class ListViewEx : ListView

private TextBox m_tb;
private ComboBox m_cb;
public ListViewEx()

m_tb = new TextBox();
m_cb = new ComboBox();
m_tb.Multiline = true;
m_tb.Visible = false;
m_cb.Visible = false;
this.GridLines = true;
//this.CheckBoxes = false;
this.FullRowSelect = true;
this.Controls.Add(m_tb);
this.Controls.Add(m_cb);

private void EditItem(ListViewItem.ListViewSubItem subItem)

if (this.SelectedItems.Count <= 0)

return;


Rectangle _rect = subItem.Bounds;
m_tb.Bounds = _rect;
m_tb.BringToFront();
m_tb.Text = subItem.Text;
m_tb.Leave += new EventHandler(tb_Leave);
m_tb.TextChanged += new EventHandler(m_tb_TextChanged);
m_tb.Visible = true;
m_tb.Tag = subItem;
m_tb.Select();

private void EditItem(ListViewItem.ListViewSubItem subItem, Rectangle rt)

if (this.SelectedItems.Count <= 0)

return;

Rectangle _rect = rt;
m_cb.Bounds = _rect;
m_cb.BringToFront();
m_cb.Items.Add(subItem.Text);
m_cb.Text = subItem.Text;
m_cb.Leave += new EventHandler(lstb_Leave);
m_cb.TextChanged += new EventHandler(m_lstb_TextChanged);
m_cb.Visible = true;
m_cb.Tag = subItem;
m_cb.Select();


protected override void OnKeyDown(KeyEventArgs e)

if (e.KeyCode == Keys.F2)

if (this.SelectedItems.Count > 0)

//this.SelectedItems[0].BeginEdit();
ListViewItem lvi = this.SelectedItems[0];
EditItem(lvi.SubItems[0],new Rectangle(lvi.Bounds.Left,lvi.Bounds.Top,this.Columns[0].Width,lvi.Bounds.Height-2));


base.OnKeyDown(e);

protected override void OnSelectedIndexChanged(EventArgs e)

this.m_tb.Visible = false;
this.m_cb.Visible = false;
base.OnSelectedIndexChanged(e);

//protected override void OnDoubleClick(EventArgs e)
//
// Point tmpPoint = this.PointToClient(Cursor.Position);
// ListViewItem item = this.GetItemAt(tmpPoint.X, tmpPoint.Y);
// if (item != null)
//
// if (tmpPoint.X > this.Columns[0].Width && tmpPoint.X < this.Width)
//
// EditItem(1);
//
//
// base.OnDoubleClick(e);
//
protected override void OnDoubleClick(EventArgs e)

Point tmpPoint = this.PointToClient(Cursor.Position);
ListViewItem.ListViewSubItem subitem = this.HitTest(tmpPoint).SubItem;
ListViewItem item = this.HitTest(tmpPoint).Item;
if (subitem != null)

if (item.SubItems[0].Equals(subitem))

EditItem(subitem, new Rectangle(item.Bounds.Left, item.Bounds.Top, this.Columns[0].Width, item.Bounds.Height-2));

else

EditItem(subitem);


base.OnDoubleClick(e);

protected override void WndProc(ref Message m)

if (m.Msg == 0x115 || m.Msg == 0x114)

this.m_tb.Visible = false;

base.WndProc(ref m);

private void tb_Leave(object sender, EventArgs e)

m_tb.TextChanged -= new EventHandler(m_tb_TextChanged);
(sender as TextBox).Visible = false;

private void m_tb_TextChanged(object sender, EventArgs e)

if ((sender as TextBox).Tag is ListViewItem.ListViewSubItem)

(this.m_tb.Tag as ListViewItem.ListViewSubItem).Text = this.m_tb.Text;



private void lstb_Leave(object sender, EventArgs e)

m_cb.TextChanged -= new EventHandler(m_lstb_TextChanged);

private void m_lstb_TextChanged(object sender, EventArgs e)

if ((sender as ListBox).Tag is ListViewItem.ListViewSubItem)

(this.m_cb.Tag as ListViewItem.ListViewSubItem).Text = this.m_cb.Text;



以上是关于excel改的日期格式为啥要双击一下单元格才能变的主要内容,如果未能解决你的问题,请参考以下文章

导出来的日期格式不对要双击一下单元格格式才变过来2012/9?

excel设置单元格格式后转变后,得双击格式才能变过来?

excel日期变数字为啥要点一下编辑栏才能变

java poi导出excel要双击才显示换行?

Excel 如何将YYYY-MM-DD日期格式改为YYYYMMDD格式

EXCEL单元格双击一下就自动换行,我已把自动换行取消了。为啥双击一下单元格还是会自动换行。