[Roam-commit] SF.net SVN: roam: [73] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2007-04-11 14:56:26
|
Revision: 73
http://roam.svn.sourceforge.net/roam/?rev=73&view=rev
Author: jonfroehlich
Date: 2007-04-11 07:56:25 -0700 (Wed, 11 Apr 2007)
Log Message:
-----------
1. overloaded SetWallpaper method in DesktopUtils to take in a bitmap and path
2. moved FormFactory from Roam.UI.Utils to Roam.UI.Forms
Modified Paths:
--------------
Trunk/Source/Roam.UI/Roam.UI.csproj
Trunk/Source/Roam.UI/Utils/DesktopUtils.cs
Trunk/Source/Roam.suo
Added Paths:
-----------
Trunk/Source/Roam.UI/Forms/FormFactory.cs
Added: Trunk/Source/Roam.UI/Forms/FormFactory.cs
===================================================================
--- Trunk/Source/Roam.UI/Forms/FormFactory.cs (rev 0)
+++ Trunk/Source/Roam.UI/Forms/FormFactory.cs 2007-04-11 14:56:25 UTC (rev 73)
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using Roam.UI.Controls;
+using System.Drawing;
+using Roam.UI.Forms;
+
+namespace Roam.UI.Forms
+{
+ public static class FormFactory
+ {
+ public static Form Create(string label, Control control)
+ {
+ FactoryForm form = new FactoryForm();
+
+ ScrollableLabel scrollableLabel = new ScrollableLabel(label);
+ form.Controls.Add(scrollableLabel);
+ form.Controls.Add(control);
+
+ scrollableLabel.Location = new Point(0, 0);
+ control.Location = new Point(0, scrollableLabel.Bottom + 1);
+
+ form.Menu = new MainMenu();
+ MenuItem menuItemLeft = new MenuItem();
+ menuItemLeft.Text = "OK";
+ menuItemLeft.Click += delegate(System.Object o, System.EventArgs e)
+ {
+ form.DialogResult = DialogResult.OK;
+ };
+ form.Menu.MenuItems.Add(menuItemLeft);
+
+ MenuItem menuItemRight = new MenuItem();
+ menuItemRight.Text = "Cancel";
+ menuItemRight.Click += delegate(System.Object o, System.EventArgs e)
+ {
+ form.DialogResult = DialogResult.Cancel;
+ };
+ form.Menu.MenuItems.Add(menuItemRight);
+ control.Focus();
+ return form;
+ }
+ }
+
+ public class FactoryForm : RoamForm
+ {
+ protected override void OnResize(EventArgs e)
+ {
+ int x = ClientRectangle.X; int y = ClientRectangle.Y;
+ foreach(Control c in this.Controls)
+ {
+ c.Width = this.ClientSize.Width;
+ c.Location = new Point(x, y);
+ if (c is ScrollableLabel)
+ {
+ c.Height = ((ScrollableLabel)c).PreferredHeight;
+ }
+
+ y = c.Bottom + 1;
+ }
+ base.OnResize(e);
+ }
+ }
+}
Modified: Trunk/Source/Roam.UI/Roam.UI.csproj
===================================================================
--- Trunk/Source/Roam.UI/Roam.UI.csproj 2007-04-09 08:03:58 UTC (rev 72)
+++ Trunk/Source/Roam.UI/Roam.UI.csproj 2007-04-11 14:56:25 UTC (rev 73)
@@ -232,7 +232,7 @@
</Compile>
<Compile Include="Utils\DesktopUtils.cs" />
<Compile Include="Utils\DrawingUtils.cs" />
- <Compile Include="Utils\FormFactory.cs">
+ <Compile Include="Forms\FormFactory.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Utils\HotKeyManager.cs" />
Modified: Trunk/Source/Roam.UI/Utils/DesktopUtils.cs
===================================================================
--- Trunk/Source/Roam.UI/Utils/DesktopUtils.cs 2007-04-09 08:03:58 UTC (rev 72)
+++ Trunk/Source/Roam.UI/Utils/DesktopUtils.cs 2007-04-11 14:56:25 UTC (rev 73)
@@ -21,6 +21,8 @@
using System.Runtime.InteropServices;
using OpenNETCF.WindowsCE;
using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
namespace Roam.UI.Utils
{
@@ -63,6 +65,18 @@
/// </summary>
public static readonly int SPI_SETDESKWALLPAPER = 20;
+ public static void SetWallpaper(Image image, string tempFilePath)
+ {
+ if (File.Exists(tempFilePath))
+ {
+ File.Delete(tempFilePath);
+ }
+
+ FileStream fs = File.Create(tempFilePath);
+ image.Save(tempFilePath, ImageFormat.Jpeg);
+ SetWallpaper(tempFilePath);
+ }
+
public static void SetWallpaper(string imageFile)
{
if (DeviceManagement.PlatformName.IndexOf("SmartPhone") != -1)
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|