- 博客(25)
- 资源 (4)
- 收藏
- 关注
原创 sqlserver导出表结构说明
SELECT表名=case when a.colorder=1 then d.name else ‘’ end,表说明=case when a.colorder=1 then isnull(f.value,’’) else ‘’ end,字段序号=a.colorder,字段名=a.name,标识=case when COLUMNPROPERTY( a.id,a.name,‘IsIdentity’)=1 then ‘√’el
2021-03-23 13:01:15
368
原创 wpf 同比例缩放不影响布局
<Viewbox Visibility="Visible" Stretch="Fill"> <Canvas x:Name="canvas" Height="768" > 布局内容。。。 </Canvas></Viewbox>
2020-09-06 10:50:39
654
原创 通过http接口请求传递数据
/// <summary> /// 通过http请求传递数据(参数为model类型) /// </summary> /// <param name="url">传递数据的url</param> /// <param name="paraJson">要传递的Json数据</param> /// <param name="requestMethod">请求方法:GET/POST/P...
2020-09-06 10:45:15
1848
原创 C#实现阻止关闭显示器和系统待机
可以通过这个SetThreadExecutionState API实现阻止系统休眠。它在C#中的声明方式如下:[DllImport("kernel32.dll")]static extern uint SetThreadExecutionState(ExecutionFlag flags);[Flags]enum ExecutionFlag : uint{ System = 0x00000001, Display = 0x00000002, Continuous = 0x
2020-09-06 10:44:38
744
原创 wpf datagrid数据 导出到excel
public static void ExportToExcel(DataGrid dataGridView1, string sheetName){SaveFileDialog fileDialog = new SaveFileDialog();fileDialog.Filter = “Excel(97-2003)|*.xls”;if (fileDialog.ShowDialog() == false){return;}//不允许dataGridView显示添加行,负责导出时会报最后一行未
2020-08-08 19:18:48
591
转载 wpf 使用log4net记录日志
现在项目涉及的是cs客户端,在项目中使用log4net记录本地日志和异常信息,这里项目做完了,想着自己做一个demo,测试记录一下log4Net的配置使用。第一步、新建一个wpf应用程序,项目右键 -----》点击NuGet程序包 -----》搜索lognet -------》点击安装第二步:在app.config中添加节点 (当然,如果是Web项目就是 web.config)配置文件代码如下:复制代码
2020-07-27 12:47:25
4965
转载 WPF自定义控件与样式(3)-TextBox & RichTextBox & PasswordBox样式、水印、Label标签、功能扩展
一.前言.预览申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接。本文主要是对文本输入控件进行样式开发,及相关扩展功能开发,主要内容包括:基本文本框TextBox控件样式及扩展功能,实现了样式、水印、Label标签、功能扩展;富文本框RichTextBox控件样式;密码输入框PasswordBox控件样式及扩展功能;效果图:二.基本文本框TextBox控件样式及扩展功能2.1 T
2020-07-20 19:06:32
746
原创 wpf 后台设置背景色16进制
new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F0F0"));
2020-07-20 15:04:29
696
原创 C#中SetWindowPos函数详解 修改窗体
[DllImport(“user32.dll”)]private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndlnsertAfter, int X, int Y, int cx, int cy, uint Flags);SetWindowPos(hWnd: HWND; {窗口句柄}hWndInsertAfter: HWND; {窗口的 Z 顺序}X, Y: Integer; {位置}cx, cy: Integer; {大小}u
2020-07-17 17:35:09
2245
原创 c# 获取当前活动窗口句柄,获取窗口大小及位置 控制向窗体发送数据 操作窗体
需调用API函数需在开头引入命名空间using System.Runtime.InteropServices;获取当前窗口句柄:GetForegroundWindow()[DllImport(“user32.dll”, CharSet = CharSet.Auto, ExactSpelling = true)]public static extern IntPtr GetForegroundWindow();返回值类型是IntPtr,即为当前获得焦点窗口的句柄使用方法 : IntPtr m
2020-07-17 17:14:47
6331
1
转载 ffmpeg 实现多宫格效果,视频拼接合成
通过FFmpeg建立画布,以多宫格方式展现一下为执行命令-re -i 1.mp4-re -i 2.mp4-re -i 3.mp4-re -i 4.mp4-filter_complex“nullsrc=size=640x480 [base]; [0:v] setpts=PTS-STARTPTS,scale=320x240 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];[2:v] setpt
2020-07-16 12:16:46
2374
原创 wpf 在windows Alt+Tab 任务视图中隐藏 定义为工具软件
#region 在windows Alt+Tab 任务视图中隐藏 定义为工具软件 [DllImport("user32.dll")] public static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); public static IntPtr SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong) { int error ...
2020-07-14 17:22:50
505
1
原创 时间戳转为C#格式时间
/// /// 时间戳转为C#格式时间/// /// Unix时间戳格式/// C#格式时间public static DateTime GetStampDateTime(double timeStamp){DateTime time = new DateTime();try{DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));long lTime = long.Parse(
2020-07-14 16:36:52
195
原创 基于TCPIP在线更新文件客户端
int uptype = 2;//1 客户端 2管理端Thread threadClient = null; // 创建用于接收服务端消息的 线程;Socket sockClient = null;DispatcherTimer timer = new DispatcherTimer();DispatcherTimer timer2 = new DispatcherTimer();private void Window_Loaded(object sender, RoutedEventArgs e
2020-07-14 13:29:36
245
原创 基于TCPIP在线更新文件服务端
Thread threadWatch = null; // 负责监听客户端连接请求的 线程; Socket socketWatch = null; Dictionary<string, Socket> dict = new Dictionary<string, Socket>(); Dictionary<string, Thread> dictThread = new Dictionary<string, Thread>();
2020-07-14 13:28:08
247
原创 非正常word(网页保存htmlword)转docx
public void TranWordDocToDocx(string pathinfo, string file){Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();Microsoft.Office.Interop.Word.Document doc = new Microsoft.Office.Interop.Word.Document();objec
2020-07-14 13:24:50
198
原创 验证应用是否重复打开
/// /// 验证重复打开应用/// /// public static bool IsRunning(){Process current = default(Process);current = System.Diagnostics.Process.GetCurrentProcess();Process[] processes = null;processes = System.Diagnostics.Process.GetProcessesByName(current.Process
2020-07-14 13:21:50
196
原创 C#删除word页眉页脚和最后一页
DirectoryInfo folder = new DirectoryInfo(tbr.Text); foreach (FileInfo file in folder.GetFiles("*.doc")) { //创建一个Document实例并加载示例文档 Spire.Doc.Document doc = new Spire.Doc.Document(); doc.LoadFromFile(fi
2020-07-14 13:16:57
1162
原创 wpf 控件跟随窗口大小调整比例
<Viewbox Stretch="Fill"> <Canvas Width="1280" Height="768"> <Grid Background="#FF009A8C" Height="727" Canvas.Left="1038"> //此处需要按比例调整的控件 </Grid > </Canvas> </Viewbo...
2020-07-14 12:02:08
2398
原创 C#设置文件夹权限,处理为Everyone所有权限
/// <summary> /// 设置文件夹权限,处理为Everyone所有权限 /// </summary> /// <param name="foldPath">文件夹路径</param> public static void SetFileRole(string foldPath) { DirectorySecurity fsec =...
2020-07-02 15:05:45
1459
原创 获取麦克风设备名称
public static List<string> GetInDeviceListFull() { List<string> devices = new List<string>(); var enumberator = new MMDeviceEnumerator(); var deviceCollection = enumberator.EnumerateAudi...
2020-07-02 15:04:19
1710
原创 FFmpeg的屏幕录制与直播
public partial class MainWindow : Window{ DrawingImage dImageSource; public MainWindow() { InitializeComponent(); ShowInTaskbar = false; } #region 模拟控制台信号需要使用的api [DllImport("kernel32.dll")] static extern boo
2020-06-28 00:39:12
153
1
原创 appSettings配置
.config<?xml version="1.0" encoding="utf-8" ?> //////appSettings配置节的value项/////////public static string GetAppConfig(string strKey){foreach (string key in ConfigurationManager.AppSettings){if (key == strKey){return Con
2020-06-28 00:02:07
869
原创 DES加密 DES解密
/// <summary> /// DES加密 /// </summary> /// <param name="data">加密数据</param> /// <param name="key">8位字符的密钥字符串</param> /// <returns></returns> public static string DESEncrypt(string data.
2020-06-28 00:00:26
210
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人