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

推荐订阅源

J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
F
Fortinet All Blogs
I
InfoQ
Jina AI
Jina AI
有赞技术团队
有赞技术团队
A
About on SuperTechFans
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
雷峰网
雷峰网
B
Blog RSS Feed
C
Check Point Blog
Y
Y Combinator Blog
博客园 - 聂微东
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
Microsoft Security Blog
Microsoft Security Blog
Engineering at Meta
Engineering at Meta
G
Google Developers Blog

博客园 - 什么都不知道

DataSet的Xml序列化问题 VB.NET的一个小问题 Access is denied的问题 - 什么都不知道 存储过程output参数问题 SQL Server的效率? datagrid刷新问题 使用Visio DrawingControl的应用开发(补) WinForm下TextBox的数据绑定和更新 使用Radio按钮选择DataGrid行 如何在运行时加载不处于应用程序目录下的assembly 使用VSA给程序加上脚本支持 删除所有Windows组件 在ASP.NET中嵌入wml标记 c#中动态装载dll 处理大型xml文件 RedirectToMobilePage的问题 使用Visio 2003 Drawing Control开发应用(3)(4) 使用Visio 2003 Drawing Control开发应用(2) 使用Visio 2003 Drawing Control开发应用(1)
突起效果的Label
什么都不知道 · 2004-10-12 · via 博客园 - 什么都不知道

现成的Winform下的Label控件的三种BorderStyle没有突起效果的,None, FixedSingle, Fixed3D。
要做个突起效果的,就继承一个Label来做。里面加上:

        protected override CreateParams CreateParams
        
{
            
get
            
{
                CreateParams cp 
= base.CreateParams;
                cp.ExStyle 
&= (~NativeMethods.WS_EXCLIENTEDGE);
                cp.Style 
&= (~NativeMethods.WS_BORDER);

                
switch(borderStyle)
                
{
                    
case BorderStyle.Fixed3D:
                        cp.ExStyle 
|= NativeMethods.WS_EXCLIENTEDGE;
                        
break;
                    
case BorderStyle.FixedSingle:
                        cp.Style 
|= NativeMethods.WS_BORDER;
                        
break;
                }

                
return cp;
            }

        }


        
public override BorderStyle BorderStyle
        
{
            
get
            
{
                
return borderStyle;
            }

            
set
            
{
                
if(borderStyle != value)
                
{
                    
if(!Enum.IsDefined(typeof(BorderStyle), value))
                    
{
                        
throw new InvalidEnumArgumentException("value", (int)value, typeof(BorderStyle));
                    }

                    borderStyle 
= value;
                    UpdateStyles();
                }

            }

        }

看结果,上面那个就是突起的Label
(代码就是MSDN里面那个创建有边框的UserControl的代码,呵呵,只是给不知道的人们看看,我上午就还不知道着呢)