Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
QuestionDesign Mode Pin
smarttom9926-Apr-06 19:28
smarttom9926-Apr-06 19:28 
AnswerRe: Design Mode Pin
alexey N26-Apr-06 20:24
alexey N26-Apr-06 20:24 
QuestionRepeated : Visio 2003 Problem or my add-in problem Pin
salman_syed_0126-Apr-06 18:43
salman_syed_0126-Apr-06 18:43 
Questiondata from client into hashtable on server Pin
salman_syed_0126-Apr-06 18:36
salman_syed_0126-Apr-06 18:36 
QuestionWeb hosting in intranet Pin
Jijo BP26-Apr-06 17:07
Jijo BP26-Apr-06 17:07 
AnswerRe: Web hosting in intranet Pin
Ed.Poore26-Apr-06 23:47
Ed.Poore26-Apr-06 23:47 
AnswerRe: Web hosting in intranet Pin
Vasudevan Deepak Kumar27-Apr-06 4:04
Vasudevan Deepak Kumar27-Apr-06 4:04 
Questiona question about WebBrowser Pin
ylw6626-Apr-06 17:00
ylw6626-Apr-06 17:00 
Sniff | :^) i use .net framework1.1, i would like to double-click notifyIcon to show a webbrowser,but the webbrowser always shows in the left and top of the screen,
i want your help, the code is follow :

namespace WindowsApplication8
{
///
/// Form1 的摘要说明。
///

public class Form1 : System.Windows.Forms.Form
{
private AxSHDocVw.AxWebBrowser axWebBrowser1;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.ComponentModel.IContainer components;

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}


private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
this.SuspendLayout();
//
// axWebBrowser1
//
this.axWebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axWebBrowser1.Enabled = true;
this.axWebBrowser1.Location = new System.Drawing.Point(0, 0);
this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
this.axWebBrowser1.Size = new System.Drawing.Size(292, 266);
this.axWebBrowser1.TabIndex = 0;
//
// notifyIcon1
//
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "notifyIcon1";
this.notifyIcon1.Visible = true;
this.notifyIcon1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDown);
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "Exit";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.axWebBrowser1);
this.Name = "Form1";
this.Text = "Form1";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
this.ResumeLayout(false);

}
#endregion


static void Main()
{
Application.Run(new Form1());
}

private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
{
this.Show();

object flags = (2 | 4 | 8);
object targetFrame = null;
object postData = null;
object headers = null;


this.axWebBrowser1.Navigate("http://www.google.com",ref flags,ref targetFrame,ref postData,ref headers);


if (this.WindowState==FormWindowState.Minimized)
this.WindowState=FormWindowState.Normal;
this.Activate();
this.notifyIcon1.Visible=false;


}

private void Form1_Load(object sender, System.EventArgs e)
{
this.notifyIcon1.Visible=true;

object flags = (2 | 4 | 8);
object targetFrame = null;
object postData = null;
object headers = null;


this.axWebBrowser1.Navigate("http://www.google.com",ref flags,ref targetFrame,ref postData,ref headers);

}

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel=true;
this.Hide();
this.ShowInTaskbar=false;
this.notifyIcon1.Visible=true;

}

private void menuItem1_Click(object sender, System.EventArgs e)
{
this.notifyIcon1.Visible=false;
Application.Exit();
}

private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
Control control = new Control(null,Control.MousePosition.X,Control.MousePosition.Y,1,1);

if (e.Button==MouseButtons.Right)
{
control.Visible = true;
control.CreateControl();
Point pos = new Point(1,1);
this.contextMenu1.Show(control,pos);
}

}
}
}
Thanks
GeneralRe: a question about WebBrowser Pin
Guffa26-Apr-06 20:52
Guffa26-Apr-06 20:52 
GeneralRe: a question about WebBrowser Pin
ylw6626-Apr-06 21:03
ylw6626-Apr-06 21:03 
GeneralRe: a question about WebBrowser Pin
Guffa26-Apr-06 22:35
Guffa26-Apr-06 22:35 
GeneralRe: a question about WebBrowser Pin
ylw6626-Apr-06 23:15
ylw6626-Apr-06 23:15 
GeneralRe: a question about WebBrowser Pin
Guffa27-Apr-06 1:07
Guffa27-Apr-06 1:07 
GeneralRe: a question about WebBrowser Pin
ylw6627-Apr-06 15:32
ylw6627-Apr-06 15:32 
GeneralRe: a question about WebBrowser Pin
Guffa28-Apr-06 3:21
Guffa28-Apr-06 3:21 
GeneralRe: a question about WebBrowser Pin
ylw6628-Apr-06 15:01
ylw6628-Apr-06 15:01 
AnswerRe: a question about WebBrowser Pin
J4amieC26-Apr-06 22:24
J4amieC26-Apr-06 22:24 
GeneralRe: a question about WebBrowser Pin
ylw6626-Apr-06 23:18
ylw6626-Apr-06 23:18 
GeneralRe: a question about WebBrowser Pin
J4amieC26-Apr-06 23:59
J4amieC26-Apr-06 23:59 
QuestionHow to decode Octal email encode Pin
kiachik26-Apr-06 14:51
kiachik26-Apr-06 14:51 
AnswerRe: How to decode Octal email encode Pin
kiachik26-Apr-06 23:46
kiachik26-Apr-06 23:46 
QuestionGetting data from listview Pin
teejayem26-Apr-06 14:38
teejayem26-Apr-06 14:38 
AnswerRe: Getting data from listview Pin
Sean8926-Apr-06 15:13
Sean8926-Apr-06 15:13 
GeneralRe: Getting data from listview Pin
teejayem26-Apr-06 15:58
teejayem26-Apr-06 15:58 
GeneralRe: Getting data from listview Pin
Sean8926-Apr-06 16:01
Sean8926-Apr-06 16:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.