|
// Copyright � 2006 by Christoph Richner. All rights are reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// website http://www.raccoom.net, email support@raccoom.net, msn chrisdarebell@msn.com
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Raccoom.Windows.Forms
{
/// <summary>
/// RssGeneratorUrlDialog let you specify a valid url.
/// </summary>
public class FormOpenUrl : System.Windows.Forms.Form
{
#region fields
private System.Windows.Forms.TextBox _textDesc;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button _pbCancel;
private System.Windows.Forms.Button _pbOK;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox _cmbFileTypes;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
#endregion
public FormOpenUrl()
{
InitializeComponent();
_cmbFileTypes.DataSource = Enum.GetNames(typeof(WindowKind));
new UrlDragDropManager(this).UrlDragDrop += new UrlDragDropManager.UrlDragDropDelegate(OnUrlDragDrop);
}
#region public interface
public System.Uri Uri
{
get
{
return new Uri(this._textDesc.Text);
}
}
public WindowKind WindowKind
{
get
{
return (WindowKind) Enum.Parse(typeof(WindowKind),_cmbFileTypes.Text, true);
}
}
#endregion
#region events
private void _textDesc_TextChanged(object sender, System.EventArgs e)
{
this._pbOK.Enabled = this._textDesc.Text.Length>0;
}
private void OnUrlDragDrop(object sender, UrlDragDropManager.UrlDragDropEventArgs e)
{
this._textDesc.Text = e.Uri.AbsoluteUri;
}
#endregion
#region Windows Form Designer generated code
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this._textDesc = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this._pbCancel = new System.Windows.Forms.Button();
this._pbOK = new System.Windows.Forms.Button();
this._cmbFileTypes = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// _textDesc
//
this._textDesc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this._textDesc.Location = new System.Drawing.Point(80, 8);
this._textDesc.Name = "_textDesc";
this._textDesc.Size = new System.Drawing.Size(344, 20);
this._textDesc.TabIndex = 0;
this._textDesc.Text = "";
this._textDesc.TextChanged += new System.EventHandler(this._textDesc_TextChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 25);
this.label1.TabIndex = 12;
this.label1.Text = "Url:";
//
// _pbCancel
//
this._pbCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this._pbCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this._pbCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this._pbCancel.Location = new System.Drawing.Point(354, 68);
this._pbCancel.Name = "_pbCancel";
this._pbCancel.TabIndex = 3;
this._pbCancel.Text = "&Cancel";
//
// _pbOK
//
this._pbOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this._pbOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this._pbOK.Enabled = false;
this._pbOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this._pbOK.Location = new System.Drawing.Point(274, 68);
this._pbOK.Name = "_pbOK";
this._pbOK.TabIndex = 2;
this._pbOK.Text = "&OK";
//
// _cmbFileTypes
//
this._cmbFileTypes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this._cmbFileTypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this._cmbFileTypes.Location = new System.Drawing.Point(81, 35);
this._cmbFileTypes.Name = "_cmbFileTypes";
this._cmbFileTypes.Size = new System.Drawing.Size(344, 21);
this._cmbFileTypes.TabIndex = 1;
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 25);
this.label2.TabIndex = 14;
this.label2.Text = "Type:";
//
// FormOpenUrl
//
this.AcceptButton = this._pbOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this._pbCancel;
this.ClientSize = new System.Drawing.Size(434, 96);
this.Controls.Add(this._cmbFileTypes);
this.Controls.Add(this.label2);
this.Controls.Add(this._textDesc);
this.Controls.Add(this.label1);
this.Controls.Add(this._pbCancel);
this.Controls.Add(this._pbOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormOpenUrl";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Open url";
this.ResumeLayout(false);
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.