Archive for the ‘Flash & VS2005’ Category

Expression Blend 4 SP1现在可以支持Flash UI组件

作者 Abel Avram 译者 李永伦

Expression Blend 4 SP1可以读取Adobe FXG文件,使得Expression开发者能够在他们的应用程序里使用Flash UI组件。

FXG是一种基于XML的图形交换格式,用于Flash,包含基本的图形和文本,遵循Flash播放器的渲染模型。FXG已被设计成一种可交换的图形格式,并适用于多个Adobe应用程序。FXG遵循许多SVG规范,但也有一些差别,尤其在渲染方面。

FXG符号是图形元素的容器。根据FXG 2.0规范,FXG提供了路径元素,作为定义各种UI组件的通用方案,但也提供现成的组件,例如矩形和椭圆。

Expression Blend 4 SP1包含了一个Adobe FXG导入插件,使得开发者可以在Expression Blend里使用FXG符号作为用户控件。这意味着重用为Flash应用程序创建的UI组件,这对于在创建组件工具箱上已经有所投入的公司来说是有吸引力的。

由于Expression Blend 4 SP1还增加了Windows Phone开发的支持,Windows Phone应用程序现在也可以使用Flash组件了。

查看英文原文:Expression Blend 4 SP 1 Now Supports Flash UI Components

 

VC++ 2008 (在系统菜单中添加菜单)

1.创建一个基于对话框的工程:AddMenuToSysMenu

2.在resouce.h中定义

#define IDI_PECULIARMENU                1201

3. OnInitDialog中添加如下代码:

     CMenu* m_pMenu = GetSystemMenu(FALSE);

     CString sysMenu = _T("系统菜单");

     m_pMenu->AppendMenu(MF_STRING, IDI_PECULIARMENU,sysMenu);

4.在OnSysCommand中添加如下代码相应自己的消息

void CTest001Dlg::OnSysCommand(UINT nID, LPARAM lParam)

{

     if ((nID & 0xFFF0) == IDM_ABOUTBOX)

     {

         CAboutDlg dlgAbout;

         dlgAbout.DoModal();

     }

     else if(nID == IDI_PECULIARMENU){

         MessageBox(_T("系统菜单"),_T("提示"),MB_OK|MB_ICONINFORMATION);

     }else{

         CDialog::OnSysCommand(nID, lParam);

     }

}


ASP.NET页面输出XML(C#)

  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   XmlDocument ObjXML = new XmlDocument();//创建XMLDOCUMENT对象
   XmlElement root = ObjXML.CreateElement("root");//创建根节点对象
   ObjXML.AppendChild(root);//插入根节点
   XmlElement user = ObjXML.CreateElement("user");//创建子节点对象
   root.AppendChild(user);//插入子节点
   user.SetAttribute("name",null,"liyan");//设置节点属性
   user.SetAttribute("passwd",null,"123");//设置节点属性
 
   XmlDeclaration xmldecl;
   xmldecl = ObjXML.CreateXmlDeclaration("1.0",null,null);
   xmldecl.Encoding="UTF-8";
   ObjXML.InsertBefore(xmldecl,root);
   string myxml = ObjXML.InnerXml.ToString();//插入XML类型头
   Response.Write(myxml);//在页面输出XML文本
  }

ASP.NET(C#与VB对照表)

这几天要做一个FLASH与ASP.NET的项目,就研究了以下ASP.NET的基本语法,以前就不喜欢VB的语法,没有规范性,所以决心借这次机会接触一下C#,感觉有了C#编写出来的东西规矩多了。找到一张C#与VB对照表,整理了一下,粘出来给大家分享。

ASP+内置支持3种语言:C#Visual Basic(注意不是VBScript),JScript。下面列出一个简单的C#VB语法对照表,看看你到底喜欢那个?
C#
语法                           VB 语法

定义变量
int x;
                 
        Dim x As Integer
String s;
               
           Dim s As String
String s1, s2;
             
           Dim s1, s2 As String
Object o;
               
         Dim o ‘Implicitly Object
Object obj = new Object();
                    Dim obj As New Object()
public String name;
                      Public name As String 

输出内容

Response.Write("foo");                   Response.Write("foo") 

注释

// This is a comment                        ‘ This is a comment
/* This is a multi-line comment */
            ‘ This is a multi-line comment 

读取数据集合数组

String s=Request.QueryString["Name"];                    Dim s, value As String
value = Request.Cookies("Key").Value
    
      s = Request.QueryString("Name")
String value=Request.Cookies["key"];
 
                 ‘Note that default non-indexed properties
                        ‘must be explicitly named in VB 
定义简单数据集

public String name {                                                  Public Property Name As String
get {                                                                           Get
                                                                              
return …;                                                                    Return   …;
}                                                                                 End Get
set {                                                                           Set
… = value;                                                                  … = Value;
}                                                                                End Set
}
 
                                                                            End Property

数组
                                                                                   ‘ Array of unspecified bounds (NA in C#)
String[] a = new String[3];                                         Dim a() As String
a[0] = "1";                                                                  a(0,0) = "1"
a[1] = "2";                                                                  a(1,0) = "2"
a[2] = "3”;                                                                  a(2,0) = "3"
String[][] a = new String[3][3];                                 Dim a(,) As String
a[0][0] = "1";                                                             a(0,0) = "1"
a[1][0] = "2";                                                             a(1,0) = "2"
a[2][0] = "3";
 
                                                         a(2,0) = "3"
                                                                                  Dim a(3) As String
                                                                                  a(0) = "1"
                                                                                  a(1) = "2"
                                                                                  a(2) = "3"
                                                                                  Dim a(3,3) As String
                                                                                  a(0,0) = "1"
                                                                                  a(1,0) = "2" 
                                                                                  a(2,0) = "3"

初始化变量

String s = "Hello World";                                           Dim s As String = "Hello World"
int i = 1                                                                       Dim i As Integer = 1
double[] a = { 3.00, 4.00, 5.00 };
 
                           Dim a() As Double = { 3.00, 4.00, 5.00 }

If 结构

if (Request.QueryString != null) {                            If Not (Request.QueryString = Null)
                                                                              
}
 
                                                                            End If

Case 结构

switch (FirstName){                                                  Select (FirstName)
case "John" :                                                              case "John" :
                                                                              
break;
case "Paul" :                                                               case "Paul" :
                                                                              
break;
case "Ringo" :                                                            case "Ringo" :
                                                                                
break;
}
 
                                                                            End Select

For 循环

for (int i=0; i<3; i++)                                                 Dim I As Integer
a(i) = "test";
 
                                                           For I = 0 To 2
                             a(I) = "test"
                  
           Next

While 循环

int i = 0;                                                                     Dim I As Integer
while (i<3) {                                                              I = 0 Do While I ❤
 

Console.WriteLine(i.ToString());                              Response.Write(I)
i += 1;                                                                        I = I + 1
}
                                                                              Loop

字符串操作

String s1;                                                                    Dim s1, s2 As String
String s2 = "hello";                                                     s2 = "hello"
s2 += " world";                                                          s2 &= " world"
s1 = s2 + " !!!";
 
                                                      s1 = s2 & " !!!"

事件处理

void MyButton_Click(Object sender, EventArgs E) { Sub MyButton_Click(Sender As Object, E As EventArgs)
…                                                                                    
}
 
                                                                                 End Sub
                                                            注意 ByVal VB中是省缺参数 

对象操作

MyObject obj = (MyObject)Session["Some Value"]; Dim bj As MyObject
IMyObject iObj = obj
 
                                            Dim iObj As IMyObject
                                obj = Session("Some Value")
                  
              iObj = CType(obj, IMyObject)

类型转换

int i = 3;
String s = i.ToString();                                                Dim i As Integer
double d = Double.Parse(s);
 
                                 Dim s As String
                              Dim d As Double
                  
            i = 3
                  
            s = i.ToString()
                  
            d = CDbl(s)
                              参见 CDbl(…), CStr(…), … 

类定义和继承

using System;                                                             Imports System
namespace MySpace {                                               Namespace MySpace
public class Foo : Bar {                                              Public Class Foo : Inherits Bar
int x;                                                                           Dim x As Integer
public Foo() {x = 4; }                                                Public Sub New()
public void Add(int x) { this.x += x; }                      MyBase.New()
public int GetNum() { return x; }                              x = 4
}                                                                                 End Sub
}                                                                                 Public Sub Add(x As Integer)
// csc /out:librarycs.dll /t:library library.cs
 
              Me.x = Me.x + x
                              End Sub
                  
            Public Function GetNum() As Integer
                  
            Return x
                  
            End Function
                                                                                    End Class
                  
            End Namespace
                              ‘ vbc /out:libraryvb.dll /t:library library.vb

用VB6.0来打造Apollo

看了一下,网上多用VS2005来调用数据库,完成FLEX与数据库的交互,今天上午研究了一下,制作了一个小程序,用VB6.0来调用数据库,这样其功能实现的更自由,也更符合软件开发的流程,要比MDM那种嵌入式语言好的多。因为了解了原理。粘个地址大家下个试试。

FLASH组件注册问题

前几天我用VS2005,VB.NET去嵌套FLASH的时候发现FlDbg9.ocx无法注册,今天终于知道怎么弄了,写出来希望遇到这样的问题的朋友能够顺利通过。
需要在windows→开始→运行里面输入如下的语句进行注册这个com组件。

语句如下:
regsvr32 c:windowssystem32macromedflasfldbg9.ocx

ActionScript 3.0与C#通讯(英文)