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

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

博客园 - 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();
        }
    }
}