This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/11572636/set-value-to-fontdialog-in-wpf/11572921#11572921 | |
// http://blogs.msdn.com/b/text/archive/2006/11/01/sample-font-chooser.aspx | |
// 微软官方博客的字体选择器例子 | |
//WPF | |
System.Windows.Forms.FontDialog fontDialog = new System.Windows.Forms.FontDialog(); | |
if (fontDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) | |
{ | |
FontFamilyConverter ffc = new FontFamilyConverter(); | |
this.textAnnotation.FontSize = fontDialog.Font.Size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NAMESPACE | |
{ | |
public enum WindowsMessage | |
{ | |
WM_NULL = 0x0000, | |
WM_CREATE = 0x0001, | |
WM_DESTROY = 0x0002, | |
WM_MOVE = 0x0003, | |
WM_SIZE = 0x0005, | |
WM_ACTIVATE = 0x0006, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace XamlConsolePrinter | |
{ | |
using System.Printing; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Threading.Tasks.Schedulers; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Xps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace XamlConsolePrinter | |
{ | |
using System.Printing; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Threading.Tasks.Schedulers; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Xps; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; This is part of my AutoHotKey [1] script. When you are in Windows Explorer it | |
; allows you to press Ctrl+Alt+N and type a filename, and that file is created | |
; in the current directory and opened in the appropriate editor (usually | |
; [gVim](http://www.vim.org/) in my case, but it will use whatever program is | |
; associated with the file in Windows Explorer). | |
; This is much easier than the alternative that I have been using until now: | |
; Right click > New > Text file, delete default filename and extension (which | |
; isn't highlighted in Windows 7), type the filename, press enter twice. | |
; (Particularly for creating dot files like ".htaccess".) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextBlock Text="Hello"> | |
<TextBlock.Style> | |
<Style TargetType="TextBlock"> | |
<Setter Property="Foreground" Value="Blue"></Setter> | |
<Style.Triggers> | |
<Trigger Property="IsMouseOver" Value="True"> | |
<Setter Property="Foreground" Value="Red" /> | |
<Setter Property="TextDecorations" Value="Underline" /> | |
</Trigger> | |
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=Text}" Value="Hello"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var input = "PQR"; | |
DataTable dt = new DataTable(); | |
dt.Columns.Add("PId", typeof(Int32)); | |
dt.Columns.Add("PName", typeof(string)); | |
dt.Columns.Add("Qty", typeof(Int32)); | |
dt.Rows.Add(123, "XYZ", 2); | |
dt.Rows.Add(223, "ABC", 4); | |
dt.Rows.Add(434, "PQR", 33); | |
var stkLists = dt.AsEnumerable().ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP PROCEDURE IF EXISTS demo; | |
CREATE PROCEDURE demo() | |
BEGIN | |
DECLARE EXIT HANDLER FOR SQLWARNING,NOT FOUND,SQLEXCEPTION | |
BEGIN | |
set @o_ret=-1; | |
SELECT -2; | |
ROLLBACK; | |
END; | |
START TRANSACTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//enter键转tab键: | |
private void EnterKey_To_TabKey(object sender, KeyEventArgs e) | |
{ | |
if (e.Key == Key.Enter) | |
{ | |
TraversalRequest request = new TraversalRequest(FocusNavigationDirection.Next); | |
((FrameworkElement)sender).MoveFocus(request); | |
} | |
} |
OlderNewer