`
阅读更多

 今天看了看IssueVision的源代码,把学习中的东西记录下来,以免忘掉了。

' Custom control that draws the caption for each pane. Contains an active 
'
 state and draws the caption different for each state. Caption is drawn
'
 with a gradient fill and antialias font.


Imports System.Drawing.Drawing2D '使用GDI+绘制渐变背景和表面文字需要引用的类
Imports System.ComponentModel

Public Class PaneCaptionClass PaneCaption
    
Inherits System.Windows.Forms.UserControl

    
' const values
    '用来控制控件表面文字绘制的属性和控件默认的缺省属性
    Private Class ConstsClass Consts
        
Public Const DefaultHeight As Integer = 26
        
Public Const DefaultFontName As String = "Tahoma"
        Public Const DefaultFontSize As Integer = 12
        
Public Const PosOffset As Integer = 4 '文字相对于容器的绘制坐标位移
    End Class


    
' internal members
    Private m_active As Boolean = False '控件激活和无效两种状态控制
    Private m_antiAlias As Boolean = True '用来控制控件表面文字的显示质量
    Private m_allowActive As Boolean = True
    
Private m_text As String = ""

    '两种状态默认文字、背景渐变颜色
    Private m_colorActiveText As Color = Color.Black
    
Private m_colorInactiveText As Color = Color.White

    
Private m_colorActiveLow As Color = Color.FromArgb(25516578)
    
Private m_colorActiveHigh As Color = Color.FromArgb(255225155)
    
Private m_colorInactiveLow As Color = Color.FromArgb(355145)
    
Private m_colorInactiveHigh As Color = Color.FromArgb(90135215)

    
' gdi objects
    '绘制显示效果的笔刷
    Private m_brushActiveText As SolidBrush
    
Private m_brushInactiveText As SolidBrush
    
Private m_brushActive As LinearGradientBrush
    
Private m_brushInactive As LinearGradientBrush
    
Private m_format As StringFormat


    
' public properties

    
' the caption of the control
    '设置控件中的文本,并且在属性面板中可以选择
    <Description("Text displayed in the caption."), _
    Category(
"Appearance"), DefaultValue("")> _
    
Public Property Caption()Property Caption() As String
        
Get
            
Return m_text
        
End Get

        
Set(ByVal value As String)
            m_text 
= value
            Invalidate() 
'重会控件的显示
        End Set
    
End Property


    
'两个同样的属性,但是在即使按照上边控制Caption属性的方式来控制Text属性,属性面板中也不显示Text属性,不知动为什么?
    Public Overrides Property Text()Property Text() As String
        
Get
            
Return Me.Caption
        
End Get
        
Set(ByVal Value As String)
            Me.Caption 
= Value
        
End Set
    
End Property


    
' if the caption is active or not
    <Description("The active state of the caption, draws the caption with different gradient colors."), _
    Category(
"Appearance"), DefaultValue(False)> _
    
Public Property Active()Property Active() As Boolean
        
Get
            
Return m_active
        
End Get
        
Set(ByVal value As Boolean)
            m_active 
= value
            Invalidate()
        
End Set
    
End Property


    
' if should maintain an active and inactive state
    <Description("True always uses the inactive state colors, false maintains an active and inactive state."), _
    Category(
"Appearance"), DefaultValue(True)> _
    
Public Property AllowActive()Property AllowActive() As Boolean
        
Get
            
Return m_allowActive
        
End Get
        
Set(ByVal value As Boolean)
            m_allowActive 
= value
            Invalidate()
        
End Set
    
End Property


    
' if the caption is active or not
    <Description("If should draw the text as antialiased."), _
     Category(
"Appearance"), DefaultValue(True)> _
    
Public Property AntiAlias()Property AntiAlias() As Boolean
        
Get
            
Return m_antiAlias
        
End Get
        
Set(ByVal value As Boolean)
            m_antiAlias 
= value
            Invalidate()
        
End Set
    
End Property


#Region 
" color properties "

    <Description("Color of the text when active."), _
    Category(
"Appearance"), DefaultValue(GetType(Color), "Black")> 
_
    
Public Property ActiveTextColor()Property ActiveTextColor() As Color
        
Get
            
Return m_colorActiveText
        
End Get
        
Set(ByVal Value As Color)
            
If Value.Equals(Color.Empty) Then Value = Color.Black
            m_colorActiveText 
= Value
            m_brushActiveText 
= New SolidBrush(m_colorActiveText)
            Invalidate()
        
End Set
    
End Property


    
<Description("Color of the text when inactive."), _
    Category(
"Appearance"), DefaultValue(GetType(Color), "White")> _
    
Public Property InactiveTextColor()Property InactiveTextColor() As Color
        
Get
            
Return m_colorInactiveText
        
End Get
        
Set(ByVal Value As Color)
            
If Value.Equals(Color.Empty) Then Value = Color.White
            m_colorInactiveText 
= Value
            m_brushInactiveText 
= New SolidBrush(m_colorInactiveText)
            Invalidate()
        
End Set
    
End Property


    
<Description("Low color of the active gradient."), _
    Category(
"Appearance"), DefaultValue(GetType(Color), "255, 165, 78")> _
    
Public Property ActiveGradientLowColor()Property ActiveGradientLowColor() As Color
        
Get
            
Return m_colorActiveLow
        
End Get
        
Set(ByVal Value As Color)
            
If Value.Equals(Color.Empty) Then Value = Color.FromArgb(25516578)
            m_colorActiveLow 
= Value
            CreateGradientBrushes()
            Invalidate()
        
End Set
    
End Property


    
<Description("High color of the active gradient."), _
    Category(
"Appearance"), DefaultValue(GetType(Color), "255, 225, 155")> _
    
Public Property ActiveGradientHighColor()Property ActiveGradientHighColor() As Color
        
Get
            
Return m_colorActiveHigh
        
End Get
&#
分享到:
评论

相关推荐

    IssueVision C#2005版

    在IssueVision 2005版中,开发人员可以通过编辑CSS样式来调整控件的颜色、字体、布局等,以适应不同团队的需求和喜好,从而提升工作效率。 此外,IssueVision的代码审核功能是其核心价值之一。该功能帮助开发者发现...

    经典智能客户端应用程序IssueVision

    《经典智能客户端应用程序IssueVision详解》 IssueVision是一款基于智能客户端技术的应用程序,它以其高效、灵活和交互性强的特点,为用户提供了卓越的用户体验。在深入探讨IssueVision之前,我们首先要理解什么是...

    IssueVision2005

    《IssueVision2005:探索SmartClient技术在项目管理中的应用》 IssueVision2005是一款由Microsoft推出的示例代码,旨在帮助开发者深入理解并掌握SmartClient技术。SmartClient技术是微软针对桌面应用程序开发提出的...

    IssueVision for Vs2003

    总的来说,IssueVision for VS2003是VB.NET环境下构建的企业级客户管理系统,其自绘控件的运用和源代码的开放性为开发者提供了丰富的定制可能性。通过理解和掌握这个系统,开发者可以进一步提升在企业级应用开发领域...

    IssueVision 源代码

    VB IssueVisoin Source Code

    C#企业级开发案例精解part1

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和 TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    C#企业级开发案例精解part2

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和 TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    taskvision源代码

    通过学习和分析TaskVision的源代码,开发者不仅可以提升C#编程技能,还能了解到.NET Framework的使用和版本迁移的注意事项,对于理解Windows桌面应用开发有极大的帮助。同时,对于想要自定义或扩展TaskVision功能的...

    美河制作.C#企业级开发案例精解.part7.rar

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    美河制作.C#企业级开发案例精解.part6.rar

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    美河制作.C#企业级开发案例精解.part2.rar

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    美河制作.C#企业级开发案例精解.part5.rar

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    美河制作.C#企业级开发案例精解.part4.rar

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    美河制作.C#企业级开发案例精解.part3.rar

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    美河制作.C#企业级开发案例精解.part1.rar

    IssueVision和TasVision系统是微软公司提供的两个智能客户端的经典范例,其中包括整个应用程序和源代码。从IssueVision和TasVision范例中,可以很清楚地了解整个智能客户端的运行过程、实现原理和软件架构。...

    一个简单的 Silverlight 4 应用程序(MEF+ MVVM+ WCF RIA Services)源代码及安装文件

    "IssueVisionforSilverlightSetup20110630" 和 "IssueVision_Silverlight20110630" 这两个文件名可能分别对应应用程序的安装程序和源代码包。"IssueVision" 很可能是这个示例应用程序的名字,它可能是一个问题跟踪或...

    。net开源项目。net开源项目

    - **简介**:DockManager 控件用于创建类似 Visual Studio 2005 的界面布局。 - **技术**:使用 C# 和 .NET 技术。 - **官网**:[DockManager Control](http://www.codeproj)。 - **特点**:支持窗口的停靠和浮动...

    C#企业级开发案例精解的源代码

    通过分析源代码,我们可以学习如何利用C#来实现这些功能。 1. 数据库交互:C#中常见的数据库访问技术包括ADO.NET、Entity Framework和Dapper等。源代码可能会展示如何使用这些库进行数据查询、事务处理和数据实体...

    Silverlight MVVMLight轻量级框架 官方实例(BUG收集系统)

    这个官方实例是一个基于Silverlight和MVVMLight的BUG收集系统,名为IssueVision.Silverlight。它展示了如何在实际项目中应用MVVMLight框架,以构建一个功能完善的用户界面,用于报告、跟踪和管理软件错误或问题...

Global site tag (gtag.js) - Google Analytics