以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 用GDI+ 写的窗口UI 怎么老是这样 重复的! (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=54341) |
-- 作者:jianjingmaoyi -- 发布时间:2014/7/25 23:04:00 -- 用GDI+ 写的窗口UI 怎么老是这样 重复的! 用GDI+ 写的窗口UI 怎么老是这样 重复的! 我已经在窗口大小的事件中放入同样的代码了 还是这样: \'e.Form.Controls("TextBox1").BackColor = system.Drawing.Color.Transparent \'DataTables("表C").SysStyles("Alternate").BackColor = SystemColors.Highlight \'-------------------窗口圆角------------------------------------------------------------- \'e.form.BaseForm.FormBorderStyle = Windows.Forms.FormBorderStyle.None \' \'e.Form.BaseForm.ControlBox = False \'e.Form.BaseForm.showintaskbar = True \'Dim r1 As Integer = CreateRoundRectRgn(0, 0, e.Form.Width-1, e.Form.Height, 10, 10) \'SetWindowRgn(e.Form.BaseForm.Handle, r1, 0) \'----------------------标题---------------------------------------------------------- e.Form.StopRedraw Dim clr As Color = SystemColors.GradientInactiveCaption e.Form.BackColor = Clr Dim p As WinForm.Painter = e.Form.Controls("Painter1") Dim g As Graphics = p.Graphics Dim Rectangle As New Rectangle(0,0,p.Width,p.Height) Dim Mybrush As New LinearGradientBrush(Rectangle,clr,Color.White,LinearGradientMode.Vertical) \'窗口渐变色 \'g.FillRectangle(Mybrush,e.form.baseform.ClientRectangle) \'窗口渐变色 g.FillRectangle(Mybrush,Rectangle) \'窗口渐变色 Dim fnt1 As New Font("微软雅黑",18,FontStyle.Italic) \'Dim fnt1 As New Font("微软雅黑",26,FontStyle.bold) Dim msg1 As String = "数据库营销系统" g.DrawString(msg1,fnt1,Brushes.Teal,88,5) \' Dim fnt2 As New Font("Vladimir Script",20) Dim msg2 As String = "Database marketing system" g.DrawString(msg2,fnt2,Brushes.Navy,71,37) g.DrawString(msg2,fnt2,Brushes.SkyBlue,72,38) If filesys.FileExists(projectpath & "images\\图标1.png") g.DrawImage(getImage("图标1.png"),5,2,72,72) End If Dim myslog As String ="当前登录:" & _UserName & " 今日为: " & Format(Date.Today,"D") & " " & Format(Date.Today,"dddd") Dim fnt_2 As New Font("微软雅黑",9) Dim MySize As SizeF = g.MeasureString(myslog,fnt_2) g.DrawString(myslog,fnt_2,Brushes.red,p.Width - MySize.Width -5,38) p.Repaint() e.Form.ResumeRedraw \'Dim br1 As Brush = New SolidBrush(Color.LightSteelBlue) \'g.FillRectangle(br1,40,114,e.Form.Width-80 ,190) \'Dim br2 As Brush = New SolidBrush(clr) \'g.FillRectangle(br2,36,110,e.Form.Width-80 ,190) \'Dim n As New Pen(Color.DodgerBlue,1) \'g.DrawRectangle(n,36,110,e.Form.Width-80 ,190) \'Dim Up As Color = Color.White \'Dim Down As Color = Color.white \'Dim Size As SizeF = g.MeasureString(msg1, Fnt1) \'Dim Point As New PointF(5,5) \'设置文字的显示位置 \'Dim Point0 As New PointF(5,5) \'设置文字的显示位置 \'Dim Rect As New RectangleF(Point, Size) \'根据文字的大小及位置,实例化RectangleF类 \'Dim LinearBrush As New LinearGradientBrush(Rect, Up, Down, LinearGradientMode.Horizontal) \'设置从左到右的线性渐变效果 \'g.DrawString(msg1, Fnt1, Brushes.Gray, Point0) \'g.DrawString(msg1, Fnt1, LinearBrush, Point) \'-------------------第二段--------------------------- \'Dim fnt_1 As New Font("微软雅黑",20) \'FontStyle.Italic) \'Dim fnt1 As New Font("微软雅黑",26,FontStyle.bold) \'Dim msg_1 As String = "企业信息管理系统" \'Dim Up_1 As Color = Color.Teal \'Dim Down_1 As Color = Color.Teal \'Dim Size_1 As SizeF = g.MeasureString(msg_1, Fnt_1) \'Dim Point_1 As New PointF(5,5) \'设置文字的显示位置 \'Dim Point0_1 As New PointF(5,5) \'设置文字的显示位置 \'Dim Rect_1 As New RectangleF(Point_1, Size_1) \'根据文字的大小及位置,实例化RectangleF类 \'Dim LinearBrush_1 As New LinearGradientBrush(Rect_1, Up_1, Down_1, LinearGradientMode.Horizontal) \'设置从左到右的线性渐变效果 \'g.DrawString(msg_1, Fnt_1, Brushes.Gray, Point0_1) \'g.DrawString(msg_1, Fnt_1, LinearBrush, Point_1) \'---------------------画线-------------------------------- \'Dim pn As New Pen(Color.White,3) \'g.DrawLine(pn,36,65,400,65) \'\'----------------英文---------------------- \'\'-----------------------画框--------------------------------- |
-- 作者:有点甜 -- 发布时间:2014/7/25 23:06:00 -- 例子发上来。 |
-- 作者:jianjingmaoyi -- 发布时间:2014/7/25 23:19:00 -- == |
-- 作者:jianjingmaoyi -- 发布时间:2014/7/25 23:30:00 -- 但是窗口大小我也重写了代码了呀 |