- 博客(27)
- 资源 (5)
- 收藏
- 关注
原创 计算一个正整数的阶乘(JavaScript)
function factorial(n) { if (isFinite(n) && n > 0 && n == Math.round(n)) { // 有限的正整数 if (!(n in factorial)) // 没有缓存结果 factorial[n] = n * factorial(
2014-08-10 10:01:02
1421
原创 在FireBug中计算Javascript 运行时间
console.time("test"); for(var i=0; i{ } console.timeEnd("test");
2014-08-09 10:42:41
545
原创 字符串转整数(C#)
using System;using System.Collections.Generic;namespace StrToInt_CS{ class Program { static void Main(string[] args) { string str = "";
2014-08-09 10:38:05
844
原创 cocos2d-x TestCpp例子工程分析
Cocos2d-x 例子工程分析类继承关系图程序执行流程程序从main.cpp执行:#include"main.h"#include"CCEGLView.h"#include"AppDelegate.h" USING_NS_CC; intAPIENTRY_tWinMain(H
2013-11-13 00:39:26
1182
原创 利用OpenXml SDK获取Word段落样式和文本
该小例子演示了如何根据RelationshipType获取文档格式和段落文本。1、代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Xml.Linq;using System.IO.Packaging;using System.I
2012-04-04 22:50:50
9977
原创 设计模式之观察者模式学习笔记
题目描述:C#编程实现猫叫时,老鼠逃跑,主人被惊醒。要求具有联动性和扩展性。1. 观察者模式结构图观察者模式定义了一种一对多的依赖关系,让多个观察者同时监视某一个主题对象。这个对象主题状态发生改变时,会通知所有观察者对象,是它们能自动更新自己。2. C# 类图3. 程序代码IObserver.csnamespace ObserverPatte
2012-03-24 23:25:25
1097
翻译 在 WPF and Silverlight 中创建和消耗资源字典
示例演示在WPF和Silverlight中如何创建和消耗资源字典1. MainPage.xaml<UserControl x:Class="SilverlightAppResourceDictionaryDemo.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml
2012-03-06 12:23:20
756
原创 利用Custom UI Editor扩展Powerpoint中图片的ContextMenu
该示例演示了如何扩展Powerpoint中图片的context menu, 若要扩展其他的context menu可以查阅并参考其它的OfficeControlIDs:http://www.microsoft.com/download/en/details.aspx?id=6627找到相应的ControlName后,可以直接替换idMso=“ControlName”1. 新建带宏的
2012-01-11 14:46:26
2209
翻译 Expression Blend 中创建时间线Storyboard实现简单的动画
创建步骤:打开Blend 4新建Silverlight Application,添加TextBlock,设置文本为 timeline storyboard 按F6进入Blend动画制作模式点击新建Storyboard图标,创建默认Storyboard1 创建完后如下图所示 抓住播放头移动到第二个时间线标记按下V键激活选择工具,
2012-01-08 18:21:57
1880
原创 利用OpenXml SDK改变Excel样式(如单元格填充色)
该Demo演示如何改变Excel总的已有样式,原有样式设置了单元格A1的填充色为红色,利用ModifyStyle方法改为黑色。代码:using System;using System.IO;using DocumentFormat.OpenXml.Packaging;using DocumentFormat.OpenXml;using DocumentFormat.OpenXml.
2012-01-06 14:42:08
10317
1
原创 以编程方式嵌入图片到Word图片内容控件
C#代码: private void button1_Click(object sender, RibbonControlEventArgs e) { // PictureContentControl myPictureContentControl = null; foreach (Microsoft.Office
2012-01-03 15:00:56
2808
原创 利用P/Invoke获取更改后的系统CultureInfo
本示例演示了如何获取更改后的系统CultureInfo,而无需重新启动Word程序加载Add-In。示例代码:using System;using Microsoft.Office.Tools.Ribbon;using System.Globalization;using System.Windows.Forms;using System.Runtime.InteropServic
2011-12-28 14:32:05
704
原创 利用OpenXml SDK冻结Excel worksheet窗格和设置列框
1. 示例代码using System.Collections.Generic;using System.Linq;using System.IO;using DocumentFormat.OpenXml.Packaging;using DocumentFormat.OpenXml.Spreadsheet;using DocumentFormat.OpenXml;namespac
2011-12-22 15:27:57
3039
原创 利用OpenXml SDK添加样式以填充Excel前景色
本示例描述了如何创建样式,并设置单元格A1,B2,C3的前景色.代码:using System;using System.IO;using DocumentFormat.OpenXml.Packaging;using DocumentFormat.OpenXml;using DocumentFormat.OpenXml.Spreadsheet;using X14 = Docume
2011-12-21 13:30:24
3589
3
原创 使用OpenXml SDK 向Excel工作簿单元格中插入公式
函数实现:private static void FillData(string path, string sheetName) { using (SpreadsheetDocument document = SpreadsheetDocument.Open( path, true)) {
2011-12-15 18:27:21
3441
原创 WP7中页面之间传值和保存恢复数据状态
1. MainPage.xaml,添加HyperlinkButton和TextBox控件 <HyperlinkBut
2011-12-15 13:52:03
1562
原创 使用OpenXml SDK向Word文档中添加页、段落、页眉和页脚
1. 创建word文档作为模版2. 以下代码实现需求using DocumentFormat.OpenXml.Packaging;using System.IO;using DocumentFormat.OpenXml.Wordprocessing;namespace OpenXmlAddParagraphsToNewPage{ class Program {
2011-12-14 16:50:52
7467
原创 利用OpenXml SDK创建Excel文件和给指定的worksheet填充数据
本程序分别演示了如何创建Excel文件并包含指定名称的Worksheet;如何给Excel文件中指定的Worksheet填充数据using System;using System.Linq;using DocumentFormat.OpenXml.Packaging;using DocumentFormat.OpenXml;using DocumentFormat.OpenXml.
2011-12-14 14:30:25
7655
原创 WP7中自定义按钮全局样式资源并绑定到按钮
1. 在MainPage.xaml中定义按钮的全局样式:边界颜色为红色,前景色为黄色 2. 绑定至按钮 3. 运行效果
2011-12-14 13:20:55
1550
原创 利用Custom Ribbon XML 重写Office内置按钮
1. 创建Office Application level AddIn(eg. Powerpoint 2010 AddIn)2. 添加Ribbon.xml <group id="MyGroup" label="My Test Group">
2011-12-13 19:29:43
5082
原创 WP7中图像控件的使用
1. 从Toolbox中拖动Image控件和Button按钮到设计器中2. 设置Image控件的Stretch属性为Uniform3 XAML代码: 4. 加载图片事件: private void
2011-12-13 13:29:03
1494
原创 OpenXml 获取Excel文件指定工作簿中的表格部件和表格数量
代码:using System;using System.Linq;using DocumentFormat.OpenXml.Packaging;using DocumentFormat.OpenXml.Spreadsheet;namespace OpenXmlExcelGetTables{ class Program { static void M
2011-12-12 15:27:17
2084
翻译 使用OpenXml SDK 给Word文档添加样式并应用于文本
例子程序演示了如何以编程的方式向Word文件中添加样式并应用于文字,运行该程序需要引用Open XML SDK, 可以从此处下载:http://www.microsoft.com/download/en/details.aspx?id=5124添加如下两个引用到项目中:WindowsBaseDocumentFormat.OpenXml (installed by the Open XM
2011-12-08 17:54:42
5042
1
原创 C#调用P/Invoke显示、隐藏和移动ListView 控件中的滚动条
小Demo演示如何调用P/Invoke显示、隐藏和移动ListView 控件中的滚动条 C#代码using System;using System.Windows.Forms;using System.Runtime.InteropServices;namespace ProgramticallyScrollListView{ public partial class f
2011-11-21 10:48:13
2632
1
原创 Access 2010 执行SQLServer 2008 R2存储过程获取返回值
该示例描述了如何利用Access ADO 执行SQLServer 中的存储过程1、运行SQL Server Management Studio, 创建数据库TestDb和如下图的表Customers:2. 创建存储过程sp_AddCustomer USE [TestDb]GO/****** Object: StoredProcedure [dbo].[sp_AddCustom
2011-11-10 16:02:34
2600
原创 Jquery 常见问题
Jquery FAQ(常见问题)1 How do I ... ? 1.1 How do I selectan item using class or ID? $(‘#divId’) This code select an element with an ID named “divId”, sinceIDs are unique, the expression can get
2011-10-27 13:06:25
1282
原创 Jquery 基本操作
Launching Code onDocument Ready Jquery Tutorials $(document).ready(function () { //alert("test"); $("a").click(function (event) { ale
2011-10-26 10:25:02
485
利用C#+Ext开发的宾馆管理系统
2010-02-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人