<Window x:Class="GuiDB.EBMultiEditTextWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GuiDB"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Background="Transparent"
Opacity="1"
WindowStyle="None"
Topmost="True"
AllowsTransparency="True" ShowInTaskbar="False"
KeyDown="Window_KeyDown"
Loaded="Window_Loaded"
>
<Grid>
<TextBox x:Name="editTextBox" Visibility="Hidden" Background="White" Foreground="Black"
BorderBrush="White" CaretBrush="White"
TextWrapping="Wrap" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" PreviewLostKeyboardFocus="editTextBox_PreviewLostKeyboardFocus"
/>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes; namespace GuiDB
{
/// <summary>
/// EBMultiEditTextWin.xaml 的交互逻辑
/// </summary>
public partial class EBMultiEditTextWin : Window
{
EBMultiTableControl _tableControl;
EBColumn _columnHeader; public EBMultiEditTextWin(EBMultiTableControl tableControl,EBColumn header,double textW,double textH,double top,double left)
{
InitializeComponent(); _tableControl = tableControl;
_columnHeader = header;
this.Width = textW;
this.Height = textH;
editTextBox.Width = textW;
editTextBox.Height = textH;
this.Top = top;
this.Left = left; } private void Window_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key.ToString() == "Return")
{
_columnHeader.Content = editTextBox.Text;
_tableControl.ReDraw();
Close();
}
else if (e.Key.ToString() == "Escape")
{
_tableControl.ReDraw();
Close();
}
} private void Window_Loaded(object sender, RoutedEventArgs e)
{
editTextBox.Visibility = Visibility.Visible;
editTextBox.FontSize = 10;
editTextBox.Text = _columnHeader.Content; editTextBox.SelectAll();
editTextBox.Focus();
} private void editTextBox_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
_columnHeader.IfBeSel = false;
_tableControl.DownPt = null;
_tableControl.ReDraw(); Task.Run(() =>
{
Dispatcher.Invoke(() => Close());
});
}
}
}

WPF透明框设置Demo的更多相关文章

  1. WPF 文本框设置了阴影效果后,因左右的transform变化引发的拉伸渲染问题

    背景 最近遇到一个动画执行时,文本位置变化的问题.如下图: 如果你仔细看的话,当星星变小时,文本往下降了几个像素. 貌似有点莫名其妙,因为控件之间并不在同一个Panel布局控件中,不存在高度限制变化引 ...

  2. WPF文本框密码框添加水印效果

    WPF文本框密码框添加水印效果 来源: 阅读:559 时间:2014-12-31 分享: 0 按照惯例,先看下效果 文本框水印 文本框水印相对简单,不需要重写模板,仅仅需要一个VisualBrush ...

  3. WPF 文本框添加水印效果

    有的时候我们需要为我们的WPF文本框TextBox控件添加一个显示水印的效果来增强用户体验,比如登陆的时候提示输入用户名,输入密码等情形.如下图所示: 这个时候我们除了可以修改TextBox控件的控件 ...

  4. WPF:DataTemplateSelector设置控件不同的样式

    原文 WPF:DataTemplateSelector设置控件不同的样式 最近想实现这么个东西,一个ListBox, 里面的ListBoxItem可能是文本框.下拉框.日期选择控件等等. 很自然的想到 ...

  5. [调整] Firemonkey iOS 原生 Edit 透明框, 改变框色

    说明:iOS 原生 Edit 透明框 适用:Berlin Firemonkey 方法:在 StyleLookup 输入 transparentedit 效果: 如果有图片 Image 在这二个 Edi ...

  6. input文本框设置和移除默认值

    input文本框设置和移除默认值 这里想实现的效果是:设置和移除文本框默认值,如下图鼠标放到文本框中的时候,灰字消失. 1.可以用简单的方式,就是给input文本框加上onfocus属性,如下代码: ...

  7. 兼容性所有浏览器的透明CSS设置

    兼容所有浏览器的透明CSS设置: .transparent_class { filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0. ...

  8. WPF提示框效果

    WPF提示框效果 1,新建WPF应用程序 2,添加用户控件Message 3,在Message中编写如下代码 <Border x:Name="border" BorderTh ...

  9. 使用Prism提供的类实现WPF MVVM点餐Demo

    使用Prism提供的类实现WPF MVVM点餐Demo 由于公司开发的技术需求,近期在学习MVVM模式开发WPF应用程序.进过一段时间的学习,感受到:学习MVVM模式,最好的方法就是用MVVM做几个D ...

  10. WPF DataGrid 样式设置

    隔行换色,鼠标单击,悬浮样式都有,其具体效果如图 1 所示. 图 1 WPF DataGrid 样式设置效果图 其中: 界面设计代码下所示 ? + 查看代码 1 2 3 4 5 6 7 8 9 10 ...

随机推荐

  1. 淘宝H5 sign加密算法

    淘宝H5 sign加密算法   淘宝H5 sign加密算法 淘宝对于h5的访问采用了和客户端不同的方式,由于在h5的js代码中保存appsercret具有较高的风险,mtop采用了随机分配令牌的方式, ...

  2. webgpu学习问题,遇到了create graphics pipeline state failed错误

    在学习webgpu并渲染图像时发生create graphics pipeline state failed with E_INVALIDARG (0x80070057)错误,图像无法成功渲染. ht ...

  3. autMan奥特曼机器人-内置wx机器人的相关说明

    内置wx机器人的相关说明 内置wxbot机器人,经常有人说在群内无回复,做以下几个工作: 给群命名 通过机器人微信APP将此群加入到通讯录 重启autMan 内置微信机器人已经支持群名设置 例如转发时 ...

  4. SpringBoot - [09] Restful风格接口方法&参数

    GetMapping.PostMapping.DeleteMapping.PutMapping是SpringBoot中常用的HTTP请求映射注解,它们分别对应HTTP协议中的GET.POST.DELE ...

  5. linux系统升级/更新OpenSSL版本操作流程记录

    问题描述:有时OpenSSL版本过老升级,或者需要更新OpenSSL版本 1.登录linux系统后输入openssl version 查看现在使用的版本 我的输入后版本信息为:OpenSSL 1.1. ...

  6. 『Python底层原理』--异步机制(async/await)

    在现代编程中,并发是提高程序效率的关键技术之一,它允许程序同时执行多个任务,充分利用系统资源. 本文将深入探讨 Python 中的async/await机制,从并发编程基础讲起,逐步剖析其工作原理和实 ...

  7. CTF常见密码汇总

    栅栏密码 fg2ivyo}l{2s3_o@aw__rcl@-->flag{w22_is_v3ry_cool} https://tool.bugku.com/jiemi/ 所谓栅栏密码,就是把要加 ...

  8. nginx 根据 URL 参数引入不同的文件

    同步发布:https://blog.jijian.link/2020-06-30/nginx-import-file/ 编程世界中各种奇奇怪怪的需求都有,本次遇到一个需求:根据URL参数判断,包含 x ...

  9. 【VMware VCF】解决 VCF 环境中组件用户密码过期问题。

    由于长时间没有启动 VCF 环境,现在在启动 SDDC Manager 组件后,UI 一直处于如下图所示的"初始化"状态.当时第一直觉就认为肯定是 VCF 环境组件的用户密码过期了 ...

  10. git clone加速

    使用github的镜像网站进行访问,github.com.cnpmjs.org,我们将原本的网站中的github.com 进行替换.