惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - h2appy

可以使用任何字体的gvim for windows vim编辑二进制文件 数据库连接字符串大全(Database Connection Strings) 在中文下安装PrimeOCR 4.5会出现“Failed open exe”错误 让WordPress注册时不发邮件,直接显示密码 组件的初始化和终止,为什么实现 Dispose 类、组件和控件 ScintillaNet 2.0的中文问题 转帖:使用 Microsoft Visual Studio 2005 时可能遇到的问题 Vmware 6.5.1正式版在Ubuntu 8.10下面运行非常缓慢的解决方法 - h2appy 给控件加上图标,让界面看起来更丰富 开源的.net图表库(A flexible charting library for .NET) 免费的中文OCR软件 转帖:一英文软件安装时出现”Failed to open EXE”问题解决 一款小软件gbridge 7zip美化 转帖:字符编码笔记:ASCII,Unicode和UTF-8 转帖:Endian的由来 字符编码(Character encoding)
改变RichTextBox光标(caret)的形状
h2appy · 2008-12-16 · via 博客园 - h2appy

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;namespace WindowsApplication1
{
    
public partial class Form1 : Form
    {
        [DllImport(
"user32.dll")]
        
static extern bool CreateCaret(IntPtr hWnd, IntPtr hBitmap, int nWidth, int nHeight);

        [DllImport(

"user32.dll")]
        
static extern bool ShowCaret(IntPtr hWnd);public Form1()
        {
            InitializeComponent();
            richTextBox1.GotFocus 
+= new EventHandler(richTextBox1_GotFocus);
        }
private void richTextBox1_GotFocus(object sender, EventArgs e)
        {
            
this.BeginInvoke(new MethodInvoker(ChangeCaret));
        }
private void richTextBox1_SelectionChanged(object sender, EventArgs e)
        {
            
this.ChangeCaret();
        }
private void richTextBox1_MouseDown(object sender, MouseEventArgs e)
        {
            
this.ChangeCaret();
        }
private void ChangeCaret()
        {
            CreateCaret(
this.richTextBox1.Handle, IntPtr.Zero, 1015);
            ShowCaret(
this.richTextBox1.Handle);
        }
private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
        {
            
this.ChangeCaret();
        }
    }
}