string text = TheTextBox.Text;
text = text.Replace(Environment.NewLine, "\r");
string[] texts = text.Split(new char[] { '\r' });
2009年10月28日
Silverlight TextBox 斷行處理
下列的範例,可以將 TextBlock.Text 所取得的字串,
拆解成字串陣列。
2009年10月27日
SyntaxHihglighter Test
為了讓程式碼看起來更整潔,
試了一下 SyntaxHihglighte,
有興趣的人可以到官網取得相關資訊。
不過為了讓 blogger 不要自動加入換行, 之前的程式碼卻變得更零亂了。
不過為了讓 blogger 不要自動加入換行, 之前的程式碼卻變得更零亂了。
function test() : String
{
return 10;
}
2009年10月25日
Silverlight String to Path
由於 Silverlight 並沒有中文字型,所以要顯示中文字便比較麻煩。
如果文字的內容是固定,可以用圖形或將文字轉成 path 的方式處理,
若文字是變動性的,甚至是由 user 來輸入,
就必須建立 WCF 由 server 端來處理了。
以下是 Server 端, 將 string 轉成 path 並傳回的方法:
以 WPF + AJAX 在執行期間將文字轉成 Path
In SL3.0, can you not just use XamlReader.Load ?
public string GetFont
(string str, string fontFamily, int nSize)
{
Typeface typeface =
new Typeface(new FontFamily(fontFamily),
FontStyles.Normal, FontWeights.Normal,
FontStretches.Normal);
FormattedText text = new FormattedText(str,
new System.Globalization.CultureInfo("zh-tw"),
FlowDirection.LeftToRight, typeface, nSize,
Brushes.Black);
Geometry geo = text.BuildGeometry(new Point(0, 0));
PathGeometry path = geo.GetFlattenedPathGeometry();
string data = path.ToString();
string xamlTriangle = "<Path xmlns='http://schemas.microsoft.com/" +
"winfx/2006/xaml/presentation' " +
"xmlns:x='http://schemas.microsoft.com/" +
"winfx/2006/xaml' " +
"Data='" + data + "' Fill='LightBlue' " +
"Stretch='Fill'/>";
return xamlTriangle;
}
而 Client 的程式如下:
void client_StringToPathCompleted(object sender,
DoWorkCompletedEventArgs e)
{
Path newPath = (Path)
System.Windows.Markup.XamlReader.Load(e.Result);
this.LayoutRoot.Children.Add(newPath);
}
[Reference]以 WPF + AJAX 在執行期間將文字轉成 Path
In SL3.0, can you not just use XamlReader.Load ?
Silverlight Color Picker and HSV RGB Convert
Silverlight 沒有 Color Dialog, 所以必需自己處理。
我找到 TeamLive Blog 有關 color picker 的文章,
覺得超棒,而且含了 XAML 語法。
可惜文章中,沒有 source code,
其中需要應用到 HSV 與 RGV 的相互轉換,
我把相關的參考資料列在下方。
我找到 TeamLive Blog 有關 color picker 的文章,
覺得超棒,而且含了 XAML 語法。
可惜文章中,沒有 source code,
其中需要應用到 HSV 與 RGV 的相互轉換,
我把相關的參考資料列在下方。
[Reference]
TeamLive Blog - Silverlight Color Picker
RGB 與 HSV 相互轉換的方法
2009年10月10日
IIS Smooth Streaming
這裡有一篇奚江華的文章,清楚介紹以 IIS Smooth Streaming建立
720p高畫質Silverlight影音串流,可以參考:
[reference]
以IIS Smooth Streaming建立720p高畫質Silverlight影音串流
720p高畫質Silverlight影音串流,可以參考:
[reference]
以IIS Smooth Streaming建立720p高畫質Silverlight影音串流
2009年9月29日
Support Silverlight System
即將支援 Silverlight 的系統如下:
- Windows Embedded CE 6.0 R3的RTM(發佈給生產廠商)版 資料來源:http://www.eettaiwan.com/ART_8800585225_676964_NP_d95e076c.HTM
- Windows Mobile 7 資料來源:http://www.fiercemobilecontent.com/story/microsoft-confirms-silverlight-windows-mobile-7/2009-09-25
- XBox 360 資料來源:http://stevesmithblog.com/blog/silverlight-3-on-xbox-360/
- Moblin 資料來源:http://blogs.zdnet.com/BTL/?p=24822
2009年9月3日
TransformToVisual
使用 UIElement.TransformToVisual 時,常常會把角色給搞混,為了一勞永逸,乾脆好好記錄下來,並用圖形來表示。
以下是將 EllipseObject 由 OriginalCanvas 轉換到 TargetCanvas,並保持不動的程式碼。
以下是將 EllipseObject 由 OriginalCanvas 轉換到 TargetCanvas,並保持不動的程式碼。
Point PointOfOriginal =
new Point(Canvas.GetLeft(EllipseObject),
Canvas.GetTop(EllipseObject));
GeneralTransform generalTransform =
OriginalCanvas.TransformToVisual(TargetCanvas);
OriginalCanvas.Children.Remove(EllipseObject);
Point PointOfTarget =
generalTransform.Transform(PointOfOriginal);
Canvas.SetLeft(EllipseObject, PointOfTarget.X);
Canvas.SetTop(EllipseObject, PointOfTarget.Y);
TargetCanvas.Children.Add(EllipseObject);
訂閱:
文章 (Atom)
Deploying Vue & .NET with Google OAuth on GCP Cloud Run
Deploying Vue & .NET with Google OAuth on GCP Cloud Run Deploying Vue & .NET with Google OAuth on GCP Cloud Run...
-
有幾個正正當當的 SEO 規則: 讓 Google 與 Yahoo 知道這個網站或網頁的存在:Google 可以透過網站管理工具,Yahoo 則透過 siteexplorer。 找出與網站相關的熱門關鍵字:既然想透過 Google 或 Yahoo 的關鍵字搜尋,當然不要選...
-
使用 WPF 建立雙螢幕或多螢幕畫面,作法如下: 首先刪除 App.xaml 中的 StartupUri="MainWindows.xaml"的設定。 加入 System.Windows.Forms (for Screen) 與 System.Drawi...
-
自從我知道了 iPhone 的 App Store 平台服務後,才發現 Google 與 Microsoft 也有類似的服務。 Apple - App Store Google - Android Market Microsoft - Windows Mobile Market...