« | September 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | | | | |
|
统计 |
blog名称:小雨 日志总数:262 评论数量:1273 留言数量:15 访问次数:4675056 建立时间:2005年1月8日 |
| 
|
W3CHINA Blog首页 管理页面 写新日志 退出
[经验杂谈]vb.net 实现模拟 msn 信息窗口 |
小雨 发表于 2006/11/4 19:07:12 | Public Class form1 Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New() MyBase.New()
'该调用是 Windows 窗体设计器所必需的。 InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。 Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Windows 窗体设计器所必需的 Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改此过程。 '不要使用代码编辑器修改它。 Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Timer1 As System.Windows.Forms.Timer Friend WithEvents Timer2 As System.Windows.Forms.Timer Friend WithEvents Timer3 As System.Windows.Forms.Timer <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Me.Label1 = New System.Windows.Forms.Label Me.Timer1 = New System.Windows.Forms.Timer(Me.components) Me.Timer2 = New System.Windows.Forms.Timer(Me.components) Me.Timer3 = New System.Windows.Forms.Timer(Me.components) Me.SuspendLayout() ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(80, 40) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(168, 136) Me.Label1.TabIndex = 0 Me.Label1.Text = "Label1hjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj" ' 'Timer1 ' Me.Timer1.Interval = 10 ' 'Timer2 ' Me.Timer2.Interval = 10 ' 'Timer3 ' Me.Timer3.Interval = 10 ' 'message ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.BackColor = System.Drawing.Color.Orange Me.ClientSize = New System.Drawing.Size(288, 224) Me.Controls.Add(Me.Label1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.Name = "message" Me.ShowInTaskbar = False Me.Text = "message" Me.TopMost = True Me.ResumeLayout(False)
End Sub
#End Region
Private Sub message_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim screen1 As Screen Dim screens() As Screen = screen1.AllScreens screen1 = screens(0) Me.Location = New Point(screen1.WorkingArea.Width - widthMax, screen1.WorkingArea.Height) Me.Timer2.Interval = StayTime ScrollShow() End Sub Dim widthMax As Integer = 300 Dim heightMax As Integer = 300
'下面是添加一个公共方法 Public Sub ScrollShow() Me.Width = widthMax - 20 Me.Height = 10 Me.Show() Me.Timer1.Enabled = True End Sub '添加一个staytime属性设置窗体停留时间(默认为5秒):
Public StayTime As Integer = 5000
Public Sub ScrollUp() If (Height < heightMax) Then Me.Height += 3 Me.Location = New Point(Me.Location.X, Me.Location.Y - 3) Else Me.Timer1.Enabled = False Me.Timer2.Enabled = True End If
End Sub
Public Sub ScrollDown() If (Height > 3) Then
Me.Height -= 3 Me.Location = New Point(Me.Location.X, Me.Location.Y + 3)
Else
Me.Timer3.Enabled = False Me.Close() End If End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ScrollUp() End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick Timer2.Enabled = False Timer3.Enabled = True End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick ScrollDown() End SubEnd Class
|
阅读全文(11946) | 回复(3) | 编辑 | 精华 |
jsp发邮件 |
小雨发表评论于2006/12/14 23:42:43 | package zj;import java.io.*;import javax.mail.*; import javax.mail.internet.*;
import javax.servlet.*;import java.util.*; import javax.servlet.http.*;
import sun.net.smtp.*;
public class test extends HttpServlet { static class SmtpAuth extends javax.mail.Authenticator { private String user,password;
public void getuserinfo(String getuser,String getpassword){ user = getuser; password = getpassword; } protected javax.mail.PasswordAuthentication getPasswordAuthentication(){ return new javax.mail.PasswordAuthentication(user,password); } } public static String MAIL_FROM = "from";
public static String MAIL_TO = "to";
public static String MAIL_SUBJECT = "subject";
public static String MAIL_BODY = "body";
public static String MAIL_HOST = "mailhost";
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
resp.setContentType("text/html; charset=gb2312");
PrintWriter out = resp.getWriter();
out.println("<form method=POST action=\"" + req.getRequestURI() + "\">");
out.println("<table>");
out.println("<tr><td>send mail server:</td>");
out.println("<td><input type=text name=" + MAIL_HOST + " size=30></td></tr>");
out.println("<tr><td>from:</td>");
out.println("<td><input type=text name=" + MAIL_FROM + " size=30></td></tr>");
out.println("<tr><td>to:</td>");
out.println("<td><input type=text name=" + MAIL_TO + " size=30></td></tr>");
out.println("<tr><td>subject:</td>");
out.println("<td><input type=text name=" + MAIL_SUBJECT + " size=30></td></tr>");
out.println("<tr><td>text:</td>");
out.println("<td><textarea name=" + MAIL_BODY + " cols=40 rows=10></textarea></td></tr>");
out.println("</table><br>");
out.println("<input type=submit value=\"Send\">");
out.println("<input type=reset value=\"Reset\">");
out.println("</form>");
out.flush();
}
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException
{
resp.setContentType("text/html; charset=gb2312"); String from = req.getParameter(MAIL_FROM);
String to = req.getParameter(MAIL_TO);
String subject = req.getParameter(MAIL_SUBJECT);
String body = req.getParameter(MAIL_BODY);
String mailhost = req.getParameter(MAIL_HOST); PrintWriter out = new PrintWriter(resp.getOutputStream()); try{SmtpAuth sa=new SmtpAuth();
sa.getuserinfo("username","pwd"); java.util.Properties props=new java.util.Properties(); props.put("mail.smtp.auth","true"); props.put("mail.smtp.host",mailhost); Session mailSession=Session.getDefaultInstance(props,sa); MimeMessage testMessage=new MimeMessage(mailSession); testMessage.setFrom(new InternetAddress(from)); testMessage.addRecipient(javax.mail.Message.RecipientType.TO,new InternetAddress(to)); testMessage.setSentDate(new java.util.Date()); testMessage.setSubject(subject); testMessage.setText(body); System.out.println("Message constructed");
Transport.send(testMessage);
}
catch (Exception ex)
{
//out.println("An error about:" + ex.getMessage());
}
out.flush();
}
public void init(ServletConfig cfg) throws ServletException
{
super.init(cfg);
}
public void destroy()
{
super.destroy();
}
}
|
个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除 |
回复:vb.net 实现模拟 msn 信息窗口 |
时钟(游客)发表评论于2006/11/10 23:03:53 | Public Class UserControl1 Inherits System.Windows.Forms.UserControl
Dim br As System.Drawing.Brush Dim s As Integer
#Region " Windows 窗体设计器生成的代码 "
Public Sub New() MyBase.New()
'该调用是 Windows 窗体设计器所必需的。 InitializeComponent() Me.ResizeRedraw = True s = 0
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'UserControl1 重写 dispose 以清理组件列表。 Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Windows 窗体设计器所必需的 Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改此过程。 '不要使用代码编辑器修改它。 Friend WithEvents Timer1 As System.Timers.Timer <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Timer1 = New System.Timers.Timer CType(Me.Timer1, System.ComponentModel.ISupportInitialize).BeginInit() ' 'Timer1 ' Me.Timer1.Enabled = True Me.Timer1.SynchronizingObject = Me Me.Timer1.Interval = 1000 Me.Timer1.Start()
' 'UserControl1 ' Me.Name = "UserControl1" CType(Me.Timer1, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
#End Region
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim w As Integer w = Width - 2 Dim h As Integer h = Height - 2 Dim i As Integer = 0 Dim a As Double e.Graphics.DrawEllipse(New Pen(Color.Blue, 2), 0, 0, w, h) e.Graphics.DrawEllipse(New Pen(Color.Blue, 2), w \ 2, h \ 2, 1, 1)
w = w - 12 h = h - 12 For i = 1 To 12 a = ((30 * i) / 180) * Math.PI e.Graphics.DrawString(CType(i, String), New Font("Veranda", 10), New SolidBrush(Color.Black), w \ 2 + (w \ 2) * Math.Sin(a), h \ 2 - (h \ 2) * Math.Cos(a)) Next
' w = w - 10 ' h = h - 10 '秒 a = ((s) / 30) * Math.PI e.Graphics.DrawLine(New Pen(Color.Red, 2), (Width - 2) \ 2, (Height - 2) \ 2, CType((w \ 2 + (w \ 2) * Math.Sin(a)), Integer) + 5, CType((h \ 2 - (h \ 2) * Math.Cos(a)), Integer) + 5) '分 a = ((s) / 1800) * Math.PI e.Graphics.DrawLine(New Pen(Color.Yellow, 2), (Width - 2) \ 2, (Height - 2) \ 2, CType((w \ 2 + (w \ 2) * Math.Sin(a)), Integer) + 5, CType((h \ 2 - (h \ 2) * Math.Cos(a)), Integer) + 5) '时 a = ((s) / 216000) * Math.PI e.Graphics.DrawLine(New Pen(Color.Black, 2), (Width - 2) \ 2, (Height - 2) \ 2, CType((w \ 2 + (w \ 2) * Math.Sin(a)), Integer) + 5, CType((h \ 2 - (h \ 2) * Math.Cos(a)), Integer) + 5) End Sub
Private Sub Timer1_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed Me.Refresh() If (s < 43200) Then s = s + 1 Else s = 0 End If
End SubEnd Class
|
个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除 |
回复:vb.net 实现模拟 msn 信息窗口 |
nrzj(游客)发表评论于2006/11/7 23:24:19 | fartherform 是父窗体的对象
|
个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除 |
窗口之间传递消息的方法 |
nrzj(游客)发表评论于2006/11/7 22:47:23 | ''''''单文档
父窗口 sonf.Owner = Me
sonf.Show()
子窗口: fartherform= Me.Owner
'''''''''''''''''''多文档
父窗口 sonf.mdiparent= Me
sonf.Show()
子窗口: fartherform= Me.mdiparent
|
个人主页 | 引用回复 | 主人回复 | 返回 | 编辑 | 删除 |
» 1 »
|