最新评论
re: 初学Attribute(一个简单实例) Sawyer 2007-12-20 10:18
Re:
"但是特性到底有什么用,这个问题一直困扰着我!除了给一些类以特别的信息之外还有什么用?"
在《Effective C#》里提到,可以自定义一些Attribute,对类使用这个特性可以使所有存储这个类对象的容器,如List<>什么的自动对对象们排序。甚至可以决定按照类的哪个属性进行排序。
它的好处是一次定义之后可以无限使用,极大的避免了repeat coding,而且能够减少error prone
因为只有这样才能体现下拉列表和组合框的灵活性。
这都不知道
re: 请教关于SharpReader xie108 2004-09-12 16:22
采用 网文快捕 可以保存网页
re: 请教关于SharpReader wangxh1000 2004-04-24 10:36
我用网文快捕webcatcher保存网页,挺好用的,: )
没关系,: ),什么事情都要从头学起的
总是要从不不会到会,从不熟悉到熟悉,今天的polarlm可能就是明天的小春、dudu,:)
慢慢来好了
polarlm以后这样私人化的文章不要放到公共区就好了,否则管理者很难给大家解释论坛的定位的,具体的可以多看看dudu,还有几位大哥的blog,看多了,就知道了
希望大家学习进步,开心,: )
re: 关于控件设计时的控制 polarlm 2004-04-09 20:31
粘贴最终的解决方案
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.ComponentModel.Design;
namespace ButtonDesignerDemo
{
/// <summary>
/// MyButton 的摘要说明。
/// </summary>
[Designer(typeof(MyButton.MyButtonDesigner))]
public class MyButton : System.Windows.Forms.Button
{
internal class MyButtonDesigner : ControlDesigner
{
protected override void OnMouseEnter()
{
Control.BackColor = Color.Pink;
}
protected override void OnMouseLeave()
{
Control.BackColor = Color.Yellow;
}
}
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public MyButton()
{
// 该调用是 Windows.Forms 窗体设计器所必需的。
InitializeComponent();
// TODO: 在 InitializeComponent 调用后添加任何初始化
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
re: 关于控件设计时的控制 宝玉 2004-04-09 13:27
protected override bool GetHitTest(Point point)
{
return true;
}
protected override void OnMouseEnter()
{
this.Control.BackColor = Color.Red;
}
re: 关于控件设计时的控制 polarlm 2004-04-09 01:17
谢谢
re: 关于控件设计时的控制 ahnan 2004-04-09 00:11
http://www.syncfusion.com/FAQ/WinForms/FAQ_c80c.asp
53.7 How do I get Mouse Messages on my Control during design-time?
The design-time will forward the MouseEnter and MouseLeave messages to your Control by default. The MouseMove message are blocked by the designer. You can get MouseDown and Up messages in your Control if you override GetHitTest method in your designer and return true, as follows:
protected override /*ControlDesigner*/ bool GetHitTest(Point point)
{
if(this.NeedMouseDown(point))
return true;
else
return false;
}
re: 初学Attribute(一个简单实例) polarlm.net 2004-04-08 10:16
re: 初学Attribute(一个简单实例) iCynosure 2004-04-07 21:30
puke,好像跑题了,而且基本概念也搞错了
re: 初学Attribute(一个简单实例) hBifTs 2004-04-07 21:29
@iCynosure
你上面所说的,其实就是Property啊...
Attribute不是这样子的...
从某一方面来说,Attribute的有无对于程序的逻辑是完全不相关的.
它只是方便程序员.
re: 初学Attribute(一个简单实例) iCynosure 2004-04-07 21:22
我对Attribute的理解和使用非常肤浅,也请各位指点。
在C++中,根据OO的原则,成员变量应该设成private,然后提供出接口来,比如:
//忽略一些检验代码
private:
int m_Age;
public:
int GetAge(){return m_Age;}
void SetAge(int AgeValue){m_Age = AgeValue;}
既然如此,为什么索性就提供一种机制,让我们在写成员变量时候就自动加入这两个访问接口呢,比如:
private int _Age;
public int Age
{
get{return _Age;}
set{_Age = value;}
}
我就这么点觉悟:)
re: 初学Attribute(一个简单实例) hBifTs 2004-04-07 18:43
re: 初学Attribute(一个简单实例) hBifTs 2004-04-07 18:01
Good~
酱紫好多了哦:P
re: 初学Attribute(一个简单实例) hBifTs 2004-04-07 17:11
咦?怎么全文都只有代码??没有任何说明么???
没有值得说明的东东么?
re: 请教关于SharpReader polarlm 2004-04-06 23:52
另外,我想问问大家,一般都用什么软件保存网页啊?SharpReader是不能保存网页的。
re: 新发现有用的站点 dudu 2004-04-06 20:02
谢谢!我将博客园的RSS提交到这个网站了。
re: 请教关于SharpReader polarlm 2004-04-06 17:50
多谢
re: 请教关于SharpReader dudu 2004-04-06 17:44
放在这: C:\Documents and Settings\你的用户名\Application Data\SharpReader
谢谢wayfarer
其实我觉得我现在的水平还是很菜的。
我需要从一些先驱者那里吸取一些经验,消化为自己的东西。
这也是我的成长过程
不正是“日记”吗?
我觉得发现有好文章,在这里推荐发表一下,也无可厚非啊。只要不乱来就行了。
转贴来的文章质量上一般是有保证的。我个人就通过在博客园里的那些转贴文章,学到不少东西。
当然,如果转贴人能有评论,或者功能扩展,自然是最好。
Sorry!
我只是觉得这篇文章写得特别好,对于现在的一些程序员有方向性的指导作用,所以就把它作为我的开篇文章。
实在抱歉!