c#窗口里这个实现该用什么控件 如图

e7300 2019-04-11 07:19:24

2列8行 鼠标点击前面序号 会选中后面字符,字符会出现选中的框,字符不可编辑。
并且选中一行鼠标停留一会会出现提示,

请教大神们,该用什么控件,怎么实现啊。
...全文
333 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
e7300 2019-05-23
  • 打赏
  • 举报
回复
结贴给分,谢谢大家
秋的红果实 2019-04-13
  • 打赏
  • 举报
回复
label,picture,form窗体等都可以吧 就是字体比较麻烦,想办法把这种字体打包进去
threenewbee 2019-04-12
  • 打赏
  • 举报
回复
直接在picturebox上画就可以了。
exception92 2019-04-12
  • 打赏
  • 举报
回复
tablelayoutpanel+label+textbox
小眼聚光~ 2019-04-12
  • 打赏
  • 举报
回复
1、定义label鼠标滑动进入事件和移出事件
2、后台new一个label控件,放入文本,设置背景色,边框和弧度,并加载到窗体中并设置隐藏,然后new一个定时器,定时5秒后显示
3、在加载到窗体后,取label的显示长度
4、在label到达5秒显示时,获取鼠标当前坐标点,计算出应显示的label的相对坐标并显示
5、鼠标移出事件中销毁这个label提示控件
路马 2019-04-12
  • 打赏
  • 举报
回复
引用 7 楼 吹风的兔子 的回复:


    public class FocusLabel :Label
    {
        private bool m_ShowBorder = false;
        
        protected override void OnPaint(PaintEventArgs e)
        {
            if (m_ShowBorder)
            {
                Rectangle rect = this.ClientRectangle;
                rect = new Rectangle(rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
                e.Graphics.DrawRectangle(new Pen(Color.Orange), rect);
            }
            base.OnPaint(e);
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            if (this.Parent != null)
            {
                foreach (Control ctrl in this.Parent.Controls)
                {
                    if (ctrl is FocusLabel && ctrl != this)
                    {
                        ((FocusLabel) ctrl).m_ShowBorder = false;
                        ctrl.Refresh();
                    }
                }
            }

            this.m_ShowBorder = true;
            this.Refresh();

        }

    }

结贴给分吧。
这位大哥讲解的很好,我最近就做了一个类似的东西,当时折腾了好久。厉害!!!
吹风的兔子 2019-04-12
  • 打赏
  • 举报
回复


    public class FocusLabel :Label
    {
        private bool m_ShowBorder = false;
        
        protected override void OnPaint(PaintEventArgs e)
        {
            if (m_ShowBorder)
            {
                Rectangle rect = this.ClientRectangle;
                rect = new Rectangle(rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
                e.Graphics.DrawRectangle(new Pen(Color.Orange), rect);
            }
            base.OnPaint(e);
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            if (this.Parent != null)
            {
                foreach (Control ctrl in this.Parent.Controls)
                {
                    if (ctrl is FocusLabel && ctrl != this)
                    {
                        ((FocusLabel) ctrl).m_ShowBorder = false;
                        ctrl.Refresh();
                    }
                }
            }

            this.m_ShowBorder = true;
            this.Refresh();

        }

    }

结贴给分吧。
吹风的兔子 2019-04-12
  • 打赏
  • 举报
回复
人家更需要的是: > 第一个要点是: Label 如何显示 边框。 > 第二个要点是: 光标在 Label 上悬浮一定时间后,显示 ToolTip。 第二个好解决,第一个 似乎需要用到重绘。
APP开发王 2019-04-12
  • 打赏
  • 举报
回复
Lable 设置 ToolTip
  • 打赏
  • 举报
回复
不知道用什么控件可以直接实现你这种效果。不过可用多个lable来实现,点击某个label时给对应的另一个label设置边框。或者用一个控件来存放这两列八行内容,获取点击坐标,然后自己绘制方框。至于提示就用ToolTip就行了
  • 打赏
  • 举报
回复
托一个ToolTip控件,在你要显示的label的属性里找到ToolTip,输入要显示的内容。toolTip的autoPopDelay可以改一下,默认5秒显示。
  • 打赏
  • 举报
回复
用toolTip控件就可以达到提示效果

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧