Sends for the fellow dear visitors:welcome to dongpad!


 Welcome to DongPad!

 msn


| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > >> 预览模式: 普通 | 列表

婚礼上的一百元

This Article is Published by Live Writer。

前日去参加一个婚礼、当牧师证婚词中用一张一百元纸钞作了个比喻,我自己听了,想跟大家分享一下。

牧师手持(里拿)一张新的百元钞票举起问大家,谁想要?

没人出声。

牧师又说不要怕羞,真的,谁想要就举手啦 ~~~

全场大约三分之一的人举手,牧师又将这张百元新钞揉成一团,再打开问现在还有谁想要?

仍然有人举手,但少了差不多一倍,牧师再将这张纸钞放在地上用力踩了几下,再捡起来打开,问大家那这样还有人要吗?

全场只有三、四个人举手。

牧师请了一位男士上台,把一百元给了这位男士,说这位男士是三次都举手的,当全场大笑时,牧师示意大家安静,并向新郎说你今天迎娶的这位心爱的女士,就如同一张新版的百元钞票,岁月加上辛劳,就如同残破的一百元钞票一样,令起初宠爱的人,变了心,事实上,这张一百元钞票仍然是一百元,它的价值全没有改变的,希望你可以像这位男士一样,懂得真正的价值和意义, 不要让外表带领你走人生路!

这个故事虽短,但当中却颇有启发。

以上数据由呵呵笑话网提供

Tags: DongPad

分类:Life | 固定链接 |评论: 0| 引用: 0 | 查看次数: 360 | 返回顶部

Difference between StaticResource and DynamicResource in WPF

This Article is Published by Live Writer。

A StaticResource will be resolved and assigned to the property during the loading of the XAML which occurs before the application is actually run. It will only be assigned once and any changes to resource dictionary ignored.

A DynamicResource assigns an Expression object to the property during loading but does not actually lookup the resource until runtime when the Expression object is asked for the value. This defers looking up the resource until it is needed at runtime. A good example would be a forward reference to a resource defined later on in the XAML. Another example is a resource that will not even exist until runtime. It will update the target if the source resource dictionary is changed.

from stackoverflow.com by Phil Wright

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 492 | 返回顶部

Quote of the Day:Get Started!

This Article is Published by Live Writer。

“It's the job that's never started that takes the longest to finish.” - J.R.R. Tolkien

Tags: DongPad

分类:Life | 固定链接 |评论: 0| 引用: 0 | 查看次数: 439 | 返回顶部

ZT-Silverlight Documentation Refresh

This Article is Published by Live Writer。

The documentation for a published product periodically receives corrections and bug fixes in a refresh update that publishes many of the changes at once. On occasion there may even be new content added that was produced since the last release.

Silverlight 3 recently had a documentation refresh to fix bugs, but what I noticed first was that an offline documentation collection was being kept in sync with the changes to the MSDN documentation. I like having an offline copy of the documentation because of the speed and responsiveness when browsing through the documentation locally.

Here's the documentation collection for Silverlight 3 compiled into a help file if you also like having access to documentation offline.

from:Nicholas Allen's Indigo Blog


Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 345 | 返回顶部

Net体系结构图

This Article is Published by Live Writer。

image

原文地址

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 468 | 返回顶部

Applications = Code + Markup读书笔记(2)

This Article is Published by Live Writer。

1.由RGB三原色组成的颜色空间也叫sRGB颜色空间,sRGB空间将显示点阵图像的做法正式化
The RGB color space implied by byte values of red, green, and blue primaries is sometimes

known as the sRGB color space, where s stands for standard. The sRGB space formalizes

common practices in displaying bitmapped images from scanners and digital cameras on

computer monitors. When used to display colors on the video display, the values of the sRGB

primaries are generally directly proportional to the voltages of the electrical signals

sent from the video display board to the monitor.

2.引入了scRGB的概念,也被称为sRGB64
关于scRGB的Wikipedia: http://en.wikipedia.org/wiki/ScRGB

3.sRGB三原色存储类型为byte,scRGB三原色存储类型为float,由于scRGB可以大于1或小于0,所以scRGB颜

色空间更大

4.Brush体系结构
Object
└─DispatcherObject (abstract)
   └─DependencyObject
      └─Freezable (abstract)
         └─Animatable (abstract)
            └─Brush (abstract)
               ├─GradientBrush (abstract)
               │ ├─LinearGradientBrush
               │ └─RadialGradientBrush
               │
               ├─SolidColorBrush
               │
               └─TileBrush (abstract)
                  ├─DrawingBrush
                  ├─ImageBrush
                  └─VisualBrush

5.关于Brush的动态事件机制,如上结构图,Brush继承自Freezable,而Freezable实现了changed事件,所以

只要Brush改变,都会通知事件的订阅者,该示例中就是通知Window来重绘窗体了,这一点需要和Winform进

行区分,Winform中除非人为处理,否则更改颜色不会触发窗体绘制
Obviously somebody is redrawing the client area every time the brush changes, but it's all

happening behind the scenes. This dynamic response is possible because Brush derives from

the Freezable class, which implements an event named Changed. This event is fired whenever

any changes are made to the Brush object, and this is how the background can be redrawn

whenever a change occurs in the brush.

This Changed event and similar mechanisms are used extensively behind the scenes in the

implementation of animation and other features in the Windows Presentation Foundation.

6.Brushes.PaleGoldenrod和new SolidColorBrush(Colors.PaleGoldenrod)虽然得到的是相同的brush,

但是在使用的时候要考虑到前者不允许被修改,因为前者是一个静态只读属性,还需要注意到Frozen的相关概念
The SolidColorBrush objects returned from the Brushes class are in a frozen state, which

means they can no longer be altered

7.LinearGradientBrush及RadialGradientBrush的一些属性和示例应用

活学活用,切勿读死书 @_@

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 368 | 返回顶部

CREATING A GLASS BUTTON: THE COMPLETE TUTORIAL

This Article is Published by Live Writer。

Well, it was a while back that I posted the first Creating a Glass button tutorial. Of course, that was based on the old look of Sparkle, and I have had some feedback recently that the project doesn't run anymore. Also, the completed tutorial never 'made it to press' leaving people with a rather lifeless button.

Well folks - GREAT NEWS - I have finished working on a all new glass button. And what better design to follow than some of the glass buttons in our shiny new OS.

Windows Vista task bar

The Windows Vista taskbar has some real nice buttons - they are see through and have an internal glow. So, I though I would base my all new complete glass button tutorial on these babies. I also hope there is enough content in the tutorial to help you explore other designs and other controls.

picture of the glass buttons app runing

So, attached to this post are the full instructions for creating the buttons above. I have also attached the finished project if you want to explore what I have done.

This has been a while coming, so please enjoy!

Attachment(s): CreatingTheGlassButton.zip

From:Martin Grayson

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 473 | 返回顶部

LINQ学习笔记及总结(1)

完整下载:/Files/DongPad/LINQApp.7z

//【一个比较简单的需求,找出年龄大于25小于30的Person】
List lpsTmp = new List{
new Person{ID=1000,Name="A",Age=24},
new Person{ID=1001,Name="B",Age=26},
new Person{ID=1002,Name="C",Age=28},
new Person{ID=1003,Name="D",Age=30},
new Person{ID=1004,Name="E",Age=32}
};
//-------------------------------------------------------
//【方式1】如果是在net1.1(1.1中还没有引入泛型概念)或2.0中,直接遍历
Console.WriteLine("方式1");
foreach (Person p in lpsTmp)
{
if (p.Age > 25 && p.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
    }
}
//-------------------------------------------------------
//-------------------------------------------------------
//【方式2】使用List的FindAll来实现,这里主要用到了2.0里的Predicate泛型委托
// Predicate可以省略
Console.WriteLine("\r\n方式2");
lpsTmp.FindAll(new Predicate(FindMatchPerson2));
//或
lpsTmp.FindAll(FindMatchPerson2);
//-------------------------------------------------------
//-------------------------------------------------------
//【方式3】方式2中我们需要额外的定义一个方法用来匹配集合中的对象
//我们可以使用更简洁的语法,那就是匿名方法, Predicate可以省略
Console.WriteLine("\r\n方式3");
lpsTmp.FindAll(new Predicate(delegate(Person p)
{
if (p.Age > 25 && p.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
return true;
    }
return false;
}));
//或
lpsTmp.FindAll(delegate(Person p) { return true; });
//-------------------------------------------------------
//-------------------------------------------------------
//【方式4】方式3中我们通过匿名方法避免了去定义一个额外的判断方法
//接下来我们来使用lambda表达式实现同样的效果
//Lambda表达式实际上为书写匿名方法提供了一种更加简单、更加函数化的语法
Console.WriteLine("\r\n方式4");
var lsps4 = lpsTmp.FindAll(new Predicate(p => p.Age > 25 && p.Age < 30));
//或
lsps4 = lpsTmp.FindAll(p => p.Age > 25 && p.Age < 30);
foreach (Person p in lsps4)
    Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
//-------------------------------------------------------
//-------------------------------------------------------
//【方式5】接下来我们使用Linq的一些静态方法,实际上List的一些扩展方法,Func可以省略
Console.WriteLine("\r\n方式5");
var lsps5 = System.Linq.Enumerable.Where(lpsTmp, new Func(FindMatchPerson2)).ToList();
//或
lsps5 = System.Linq.Enumerable.Where(lpsTmp, FindMatchPerson2).ToList();
//上面的【方式5】与【方式2】比较类似,都是委托给FindMatchPerson2来执行
//下同【方式3】,使用了匿名方法,可以省略Func
lsps5 = System.Linq.Enumerable.Where(lpsTmp, new Func(delegate(Person ppTmp)
{
if (ppTmp.Age > 25 && ppTmp.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", ppTmp.Name, ppTmp.ID, ppTmp.Age));
return true;
    }
return false;
})).ToList();
//下同【方式4】,使用lambda表达式,可以省略Func
lsps5 = System.Linq.Enumerable.Where(lpsTmp, new Func(p => p.Age > 25 && p.Age < 30)).ToList();
//-------------------------------------------------------
//-------------------------------------------------------
//【方式6】接下来我们使用List的一些扩展方法,这主要是为了接下来使用Linq做个铺垫
//因为linq的本质就是使用扩展方法扩展了对集合类型的各种查询方法,Func可以省略
Console.WriteLine("\r\n方式6");
var lsps6 = lpsTmp.Where(new Func(FindMatchPerson2)).ToList();
//或
lsps6 = lpsTmp.Where(FindMatchPerson2).ToList();
//上面的【方式6】与【方式2】比较类似,都是委托给FindMatchPerson2来执行
//下同【方式3】,使用了匿名方法,可以省略Func
lsps6 = lpsTmp.Where(new Func(delegate(Person ppTmp)
{
if (ppTmp.Age > 25 && ppTmp.Age < 30)
    {
        Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", ppTmp.Name, ppTmp.ID, ppTmp.Age));
return true;
    }
return false;
})).ToList();
//下同【方式4】,使用lambda表达式,可以省略Func
lsps6 = lpsTmp.Where(new Func(p => p.Age > 25 && p.Age < 30)).ToList();
//-------------------------------------------------------
//-------------------------------------------------------
//【方式7】最后我们使用Linq语法来实现同样的效果
Console.WriteLine("\r\n方式7");
var lsps7 = from p in lpsTmp where p.Age > 25 && p.Age < 30 select p;
foreach (Person p in lsps7)
    Console.WriteLine(string.Format("{0}'s ID is {1},{2} years old", p.Name, p.ID, p.Age));
//-------------------------------------------------------
//-------------------------------------------------------
//通过这里列出的几种实现方式,我们会发现用来实现的代码越来越简洁,随之提升将不仅仅是编码效率哦.吼吼!!!
//这里除了Linq,成员方法,静态方法和扩展方法都可以分别使用命名委托、匿名委托或Lambda表达式作为参数!!!
//这里代码演变到简洁的过程如下:
//命名委托==>匿名委托==>Lambda表达式
//成员方法(list.FindAll)==>静态方法==>扩展方法==>Linq
//综上所述,Linq的本质无外乎委托,整一个活生生的"语法糖",他把许多东西都交给编译器来处理了
//由此可见,在学习的过程中举一反三还是比较重要的,知其然更要知其所以然,通过了解本质,对于我们来说将更容易掌握知识,应用知识!!!
//所涉及之处,难免会存在一些问题,诚恳希望大伙们能够提出并一起讨论!!!
//参考资料:《LINQ-the future of data access in c# 3.0》
//-------------------------------------------------------


Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 358 | 返回顶部

44个Silverlight 视频讲座

This Article is Published by Live Writer。

01. Silverlight - Hello World
02. Silverlight - Anatomy of an Application
03. Silverlight - The VS Environment
04. Silverlight - Content Controls
05. Silverlight - Built-In Controls
06. Silverlight - Width, Height, Margins, Padding, Alignment
07. Silverlight - Using a GridSplitter
08. Silverlight - Grid Layout
09. Silverlight - StackPanel Layout
10. Silverlight - Canvas Layout
11. Silverlight - Databinding UI to .NET Classes
12. Silverlight - Simple Styles
13. Silverlight - Custom Types in XAML
14. Silverlight - Binding with Conversion
15. Silverlight - List Based Data Binding
16. Silverlight - Simple User Control
17. Silverlight - Templating a Button
18. Silverlight - Resources from XAP/DLL/Site Of Origin
19. Silverlight - Animations & Storyboards
20. Silverlight - Uploads with WebClient
21. Silverlight - Downloads with WebClient
22. Silverlight - Calling HTTPS Web Services
23. Silverlight - Calling Web Services
24. Silverlight - Making Cross Domain Requests
25. Silverlight - Using HttpWebRequest
26. Silverlight - File Dialogs and User Files
27. Silverlight - Using Sockets
28. Silverlight - Using Isolated Storage
29. Silverlight - .NET Code Modifying HTML
30. Silverlight - Using Isolated Storage Quotas
31. Silverlight - Calling JavaScript from .NET
32. Silverlight - Evaluating JavaScript from .NET Code
33. Silverlight - Handling HTML Events in .NET Code
34. Silverlight - Handling .NET Events in JavaScript
35. Silverlight - Calling .NET from JavaScript
36. Silverlight - Displaying a Custom Splash Screen
37. Silverlight - Passing Parameters from your Web Page
38. Silverlight - Loading Media at Runtime
39. Silverlight - Dynamically Loading Assemblies/Code
40. Silverlight - Reading/Writing XML
41. Silverlight - Multiple Threads with BackgroundWorker
42. Silverlight - Insert/Update/Delete with the DataGrid
43. Silverlight - Getting Started with the DataGrid
44. Silverlight - Embedding Custom Fonts

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 407 | 返回顶部

Applications = Code + Markup读书笔记(1)

This Article is Published by Live Writer。

1. 关于Application和Window的层次结构

Object
└─DispatcherObject (abstract)
    ├─Application
    └─DependencyObject
        └─Visual (abstract)
           └─UIElement
               └─FrameworkElement
                   └─Control
                       └─ContentControl
                           └─Window

2.如果没有显示的设置Window的宽或高,他们的值将始终是NaN

The Width and Height properties are initially undefined, and if your program never sets them, they remain undefined, which means they have values of NaN, the abbreviation immortalized by the IEEE (Institute of Electrical and Electronics Engineers, Inc.) floating-point standard for "not a number."

3.与设备无关单位(1/96inches),这一点需要与DPI进行区分

The units in which you specify all dimensions and locations in Windows Presentation Foundation are sometimes called device-independent pixels or logical pixels but it's probably best not to refer to pixels at all.

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 405 | 返回顶部
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > >>