wpf 3

Today, I continue do some search for Wpf, I found something misunderstand before.

For example, MouseEventArgs.GetPostion(), at last article, I pass in (IInputElement)this, but it's wrong, it should pass

(UIElement)sender.

 

Also, I found new differnces:

 

1, MouseDown and MouseUp use MouseButtonEventArgs instead of MouseEventArgs, it different from MouseMove.

    And e.Button == MouseButtons.Left should change to e.ChangeButton == MouseButton.Left

 

namespace System.Windows.Input

{

// Summary:

// Defines values that specify the buttons on a mouse device.

public enum MouseButton

{

// Summary:

// The left mouse button.

Left = 0,

//

// Summary:

// The middle mouse button.

Middle = 1,

//

// Summary:

// The right mouse button.

Right = 2,

//

// Summary:

// The first extended mouse button.

XButton1 = 3,

//

// Summary:

// The second extended mouse button.

XButton2 = 4,

}

}

 

But original one is lile:

using System;

using System.Runtime.InteropServices;

namespace System.Windows.Forms

{

// Summary:

// Specifies constants that define which mouse button was pressed.

[Flags]

[ComVisible(true)]

public enum MouseButtons

{

// Summary:

// No mouse button was pressed.

None = 0,

//

// Summary:

// The left mouse button was pressed.

Left = 1048576,

//

// Summary:

// The right mouse button was pressed.

Right = 2097152,

//

// Summary:

// The middle mouse button was pressed.

Middle = 4194304,

//

// Summary:

// The first XButton was pressed.

XButton1 = 8388608,

//

// Summary:

// The second XButton was pressed.

XButton2 = 16777216,

}

}

 

2, Point changes a lot, I will write detail thing for it later. Also contains Size, Vector..

 

3, use DrawingContext replace Graphics, 

    use OnRender(DrawingContext) replace OnPaint(PaintEventArgs)

    I will write detail thing later.

 

4, ColorPickerCustomControl

This sample shows how to create a custom control and display it in a dialog window. This sample defines a custom color picker control that enables users to browse colors by their hue, saturation, and brightness. The control also enables the user to enter RGB, scRGB, and hexadecimal values directly.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值