This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Initial import

svn path=/trunk/winforms-tools/; revision=42464
  • Loading branch information...
Alexander Olk
Alexander Olk committed Apr 1, 2005
0 parents commit 6224fc2edf84a7e4dc1fb15c41fceddf421668a5
@@ -0,0 +1,161 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MWFResourceEditor
+{
+ public class AboutDialog : Form
+ {
+ private Button okButton;
+ private PaintPanel paintPanel;
+
+ public AboutDialog( )
+ {
+ okButton = new Button( );
+ paintPanel = new PaintPanel( );
+
+ SuspendLayout( );
+
+ okButton.Text = "OK";
+ okButton.Location = new Point( 170, 260 );
+ okButton.Click += new EventHandler( OnOkButtonClick );
+
+ paintPanel.BorderStyle = BorderStyle.Fixed3D;
+ paintPanel.Location = new Point( 10, 10 );
+ paintPanel.Size = new Size( 380, 240 );
+ paintPanel.BackColor = Color.White;
+
+ Text = "About MWFResourceEditor...";
+
+ this.FormBorderStyle = FormBorderStyle.FixedDialog;
+
+ ClientSize = new Size( 400, 300 );
+
+ AcceptButton = okButton;
+
+ Controls.Add( okButton );
+ Controls.Add( paintPanel );
+
+ ResumeLayout( false );
+ }
+
+ void OnOkButtonClick( object sender, EventArgs e )
+ {
+ Close( );
+ }
+
+ internal class PaintPanel : Panel
+ {
+ private System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
+
+ private Font paintFont;
+ private Font smallFont;
+ private SolidBrush managedPaintBrush;
+ private SolidBrush windowsPaintBrush;
+ private SolidBrush formsPaintBrush;
+ private SolidBrush shadowBrush;
+ private Color paintColor;
+ private int counter = 0;
+ private bool managedDrawn = false;
+ private bool windowsDrawn = false;
+ private bool formsDrawn = false;
+
+ private const int alphaMax = 32;
+
+ public PaintPanel( )
+ {
+ paintFont = new Font( FontFamily.GenericMonospace, 36, FontStyle.Regular );
+ smallFont = new Font( FontFamily.GenericSansSerif, 18, FontStyle.Italic );
+
+ paintColor = Color.FromArgb( 0, Color.Red );
+ shadowBrush = new SolidBrush( Color.FromArgb( 180, Color.LightBlue ) );
+
+ windowsPaintBrush = new SolidBrush( paintColor );
+ managedPaintBrush = new SolidBrush( paintColor );
+ formsPaintBrush = new SolidBrush( paintColor );
+
+ timer.Tick += new EventHandler( OnTimerTick );
+ timer.Interval = 50;
+ }
+
+ protected override void OnPaint( PaintEventArgs pea )
+ {
+ base.OnPaint( pea );
+
+ Bitmap bmp = new Bitmap( pea.ClipRectangle.Width, pea.ClipRectangle.Height, pea.Graphics );
+ Graphics gr = Graphics.FromImage( bmp );
+
+ if ( formsDrawn )
+ {
+ gr.DrawString( "Managed", paintFont, shadowBrush, new Point( 75, 15 ) );
+ gr.DrawString( "Windows", paintFont, shadowBrush, new Point( 75, 65 ) );
+ gr.DrawString( "Forms", paintFont, shadowBrush, new Point( 75, 115 ) );
+
+ gr.DrawString( "Resource Editor", smallFont, new SolidBrush( Color.Black ), new Point( 80, 185 ) );
+
+ managedPaintBrush = new SolidBrush( Color.Red );
+ windowsPaintBrush = new SolidBrush( Color.Red );
+ formsPaintBrush = new SolidBrush( Color.Red );
+ }
+
+ gr.DrawString( "Managed", paintFont, managedPaintBrush, new Point( 70, 10 ) );
+
+ gr.DrawString( "Windows", paintFont, windowsPaintBrush, new Point( 70, 60 ) );
+
+ gr.DrawString( "Forms", paintFont, formsPaintBrush, new Point( 70, 110 ) );
+
+ pea.Graphics.DrawImage( bmp, pea.ClipRectangle.X, pea.ClipRectangle.Y );
+ }
+
+ protected override void OnVisibleChanged( EventArgs e )
+ {
+ if ( Visible )
+ timer.Start( );
+ else
+ timer.Stop( );
+
+ base.OnVisibleChanged( e );
+ }
+
+ void OnTimerTick( object sender, EventArgs e )
+ {
+ if ( !managedDrawn )
+ {
+ paintColor = Color.FromArgb( counter++, Color.Red );
+ managedPaintBrush = new SolidBrush( paintColor );
+ if ( counter == alphaMax )
+ {
+ managedDrawn = true;
+ counter = 0;
+ }
+ }
+ else
+ if ( !windowsDrawn )
+ {
+ paintColor = Color.FromArgb( counter++, Color.Red );
+ windowsPaintBrush = new SolidBrush( paintColor );
+ if ( counter == alphaMax )
+ {
+ windowsDrawn = true;
+ counter = 0;
+ }
+ }
+ else
+ if ( !formsDrawn )
+ {
+ paintColor = Color.FromArgb( counter++, Color.Red );
+ formsPaintBrush = new SolidBrush( paintColor );
+ if ( counter == alphaMax )
+ {
+ formsDrawn = true;
+ timer.Stop( );
+ }
+ }
+
+
+ Invalidate( );
+ Update( );
+ }
+ }
+ }
+}
@@ -0,0 +1,5 @@
+2005-04-01 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * AboutDialog.cs, ContentStruct.cs, ContentType.cs, ImagePanel.cs,
+ MainForm.cs, TextEntryDialog.cs, TextPanel.cs:
+ Initial import
@@ -0,0 +1,24 @@
+using System;
+using System.Drawing;
+
+namespace MWFResourceEditor
+{
+ public struct ContentStruct
+ {
+ public Image image;
+
+ public string text;
+
+ public ContentType ctype;
+
+ public ContentStruct Clone( )
+ {
+ return (ContentStruct)MemberwiseClone( );
+ }
+ }
+}
+
+
+
+
+
@@ -0,0 +1,13 @@
+using System;
+
+namespace MWFResourceEditor
+{
+ public enum ContentType
+ {
+ TypeImage,
+ TypeString,
+ TypeByte
+ }
+}
+
+
@@ -0,0 +1,89 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MWFResourceEditor
+{
+ public class ImagePanel : Panel
+ {
+ private Image image;
+ private string imageName;
+ private PictureBox pictureBox;
+ private Button button;
+
+ private MainForm parentForm;
+
+ public ImagePanel( MainForm parentForm )
+ {
+ this.parentForm = parentForm;
+
+ button = new Button( );
+ pictureBox = new PictureBox( );
+ SuspendLayout( );
+
+ BackColor = Color.LightSlateGray;
+
+ button.Location = new Point( 10, 10 );
+ button.Size = new Size( 120, 21 );
+ button.Text = "Change Image";
+ button.Click += new EventHandler( OnClickButton );
+
+ Controls.Add( button );
+ Controls.Add( pictureBox );
+
+ ResumeLayout( false );
+ }
+
+ public Image Image
+ {
+ set
+ {
+ image = value;
+ pictureBox.Image = value;
+ pictureBox.Size = image.Size;
+ pictureBox.Location = new Point( ( Width / 2 ) - ( image.Width / 2 ), ( Height / 2 ) - ( image.Height / 2 ) );
+ }
+
+ get
+ {
+ return image;
+ }
+ }
+
+ public string ImageName
+ {
+ set
+ {
+ imageName = value;
+ }
+
+ get
+ {
+ return imageName;
+ }
+ }
+
+ void OnClickButton( object sender, EventArgs e )
+ {
+ OpenFileDialog ofd = new OpenFileDialog( );
+ ofd.CheckFileExists = true;
+
+ ofd.Filter = "Images (*.png;*.jpg;*.gif;*.bmp)|*.png;*.jpg;*.gif;*.bmp|All files (*.*)|*.*";
+
+ if ( DialogResult.OK == ofd.ShowDialog( ) )
+ {
+ Image = Image.FromFile( ofd.FileName );
+
+ imageName = ofd.FileName;
+
+ string[] split = imageName.Split( new Char[] { '\\', '/' } );
+
+ if ( split.Length > 0 )
+ imageName = split[ split.Length - 1 ];
+
+ parentForm.ChangeContentImage( );
+ }
+ }
+ }
+}
+
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{BC33943A-2C2F-488F-B544-6556791094FB}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>MWFResourceEditor</RootNamespace>
+ <AssemblyName>MWFResourceEditor</AssemblyName>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugSymbols>false</DebugSymbols>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System"/>
+ <Reference Include="System.Data"/>
+ <Reference Include="System.Drawing"/>
+ <Reference Include="System.Windows.Forms"/>
+ <Reference Include="System.Xml"/>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/>
+ <ItemGroup>
+ <Compile Include="AboutDialog.cs"/>
+ <Compile Include="ContentStruct.cs"/>
+ <Compile Include="ContentType.cs"/>
+ <Compile Include="ImagePanel.cs"/>
+ <Compile Include="MainForm.cs"/>
+ <Compile Include="TextEntryDialog.cs"/>
+ <Compile Include="TextPanel.cs"/>
+ </ItemGroup>
+</Project>
@@ -0,0 +1,18 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MWFResourceEditor", "MWFResourceEditor.csproj", "{BC33943A-2C2F-488F-B544-6556791094FB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {BC33943A-2C2F-488F-B544-6556791094FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BC33943A-2C2F-488F-B544-6556791094FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BC33943A-2C2F-488F-B544-6556791094FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BC33943A-2C2F-488F-B544-6556791094FB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Oops, something went wrong.

0 comments on commit 6224fc2

Please sign in to comment.