|
using System;
using System.Drawing;
using System.Windows.Forms;
using Pvax.Shell;
namespace LinkView
{
/// <summary>
/// Description of MainForm.
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbWorkingFolder;
private System.Windows.Forms.Label dropPanel;
private System.Windows.Forms.TextBox tbTarget;
private System.Windows.Forms.TextBox tbDescription;
public MainForm()
{
InitializeComponent();
}
[STAThread]
public static void Main(string[] args)
{
Application.Run(new MainForm());
}
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.tbDescription = new System.Windows.Forms.TextBox();
this.tbTarget = new System.Windows.Forms.TextBox();
this.dropPanel = new System.Windows.Forms.Label();
this.tbWorkingFolder = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// tbDescription
//
this.tbDescription.Location = new System.Drawing.Point(8, 144);
this.tbDescription.Multiline = true;
this.tbDescription.Name = "tbDescription";
this.tbDescription.Size = new System.Drawing.Size(296, 64);
this.tbDescription.TabIndex = 5;
this.tbDescription.Text = "";
//
// tbTarget
//
this.tbTarget.Location = new System.Drawing.Point(8, 32);
this.tbTarget.Name = "tbTarget";
this.tbTarget.Size = new System.Drawing.Size(296, 20);
this.tbTarget.TabIndex = 1;
this.tbTarget.Text = "";
//
// dropPanel
//
this.dropPanel.AllowDrop = true;
this.dropPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dropPanel.Font = new System.Drawing.Font("Times New Roman", 26F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World, ((System.Byte)(204)));
this.dropPanel.Location = new System.Drawing.Point(8, 216);
this.dropPanel.Name = "dropPanel";
this.dropPanel.Size = new System.Drawing.Size(296, 96);
this.dropPanel.TabIndex = 7;
this.dropPanel.Text = "Drop shortcuts here";
this.dropPanel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.dropPanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.DropPanelDragEnter);
this.dropPanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.DropPanelDragDrop);
//
// tbWorkingFolder
//
this.tbWorkingFolder.Location = new System.Drawing.Point(8, 88);
this.tbWorkingFolder.Name = "tbWorkingFolder";
this.tbWorkingFolder.Size = new System.Drawing.Size(296, 20);
this.tbWorkingFolder.TabIndex = 3;
this.tbWorkingFolder.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "Target:";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 64);
this.label2.Name = "label2";
this.label2.TabIndex = 2;
this.label2.Text = "Working folder:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 120);
this.label3.Name = "label3";
this.label3.TabIndex = 4;
this.label3.Text = "Description:";
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(312, 324);
this.Controls.Add(this.dropPanel);
this.Controls.Add(this.tbDescription);
this.Controls.Add(this.label3);
this.Controls.Add(this.tbWorkingFolder);
this.Controls.Add(this.label2);
this.Controls.Add(this.tbTarget);
this.Controls.Add(this.label1);
this.Name = "MainForm";
this.Text = "MainForm";
this.ResumeLayout(false);
}
#endregion
void DropPanelDragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
ShellLink link = new ShellLink();
link.Load(files[0]);
tbTarget.Text = link.Path;
tbDescription.Text = link.Description;
tbWorkingFolder.Text = link.WorkingDirectory;
}
}
void DropPanelDragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
}
}
|
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.
I'm a system administrator from Moscow, Russia. Programming is one of my hobbies. I presume I'm one of the first Russians who created a Web site dedicated to .Net known that time as NGWS. However, the Web page has been abandoned a long ago.