Dim gr As Graphics = Me.CreateGraphics
Private cv1, cv2 As Color, _
namElem, simElem, num1Elem, num2Elem, lneElem, nomElem As String, _
bol As Boolean, _
MeWidth As Integer = Me.Width, MeHeight As Integer = Me.Height
Private t1 As New Point(0, 0), t2 As New Point(Me.Width, Me.Height)
Private ts1, ts2, ts3, ts4, ts5, ts6 As New Point
Private neFont As New Font("Franklin Gothic Medium", 8, FontStyle.Regular), _
seFont As New Font("Franklin Gothic Medium", 12, FontStyle.Bold), _
lneFont As New Font("Franklin Gothic Medium", CSng(77 / 10), FontStyle.Italic), _
nomFont As New Font("Franklin Gothic Medium", CSng(84 / 10), FontStyle.Regular), _
numFont As New Font("Franklin Gothic Medium", 9, FontStyle.Regular), _
num2Font As New Font("Franklin Gothic Medium", 8, FontStyle.Regular)
Private grad = New LinearGradientBrush(t1, t2, cv1, cv2)
Private textElem As SolidBrush
Private recGr As New Rectangle(0, 0, Me.Width, Me.Height)
Private Sub MeResize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
t2 = New Point(Me.Width, Me.Height)
recGr = New Rectangle(0, 0, Me.Width, Me.Height)
grad = New LinearGradientBrush(t1, t2, cv1, cv2)
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim t1x As Integer = CInt(Me.Width / 235), _
t1y As Integer = CInt(Me.Height / 112.5), _
t2x As Integer = CInt(Me.Width / 235), _
t2y As Integer = CInt(Me.Height / 1.55175), _
t3x As Integer = CInt(Me.Width / 940), _
t3y As Integer = CInt(Me.Height / 2.25), _
t4x As Integer = CInt(Me.Width / 1.402985), _
t4y As Integer = CInt(Me.Height / 1.60714), _
t5x As Integer = CInt(Me.Width / 2.848485), _
t5y As Integer = CInt(Me.Height / 112.5), _
t6x As Integer = CInt(Me.Width / 1.67857), _
t6y As Integer = CInt(Me.Height / 4.0909091)
ts1.X = t1x : ts1.Y = t1y
ts2.X = t2x : ts2.Y = t2y
ts3.X = t3x : ts3.Y = t3y
ts4.X = t4x : ts4.Y = t4y
ts5.X = t5x : ts5.Y = t5y
ts6.X = t6x : ts6.Y = t6y
e.Graphics.FillRectangle(grad, recGr)
e.Graphics.DrawString(simElem, seFont, textElem, ts1.X, ts1.Y)
e.Graphics.DrawString(namElem, neFont, textElem, ts2.X, ts2.Y)
e.Graphics.DrawString(lneElem, lneFont, textElem, ts3.X, ts3.Y)
e.Graphics.DrawString(nomElem, nomFont, textElem, ts4.X, ts4.Y)
e.Graphics.DrawString(num1Elem, numFont, textElem, ts5.X, ts5.Y)
e.Graphics.DrawString(num2Elem, num2Font, textElem, ts6.X, ts6.Y)
End Sub
Imports System.Drawing.Drawing2D
Public Class Class2
Inherits Control
Dim cv1 As Color = Color.AliceBlue
Dim cv2 As Color = Color.Blue
Dim namElem As String = "namElem", simElem As String = "Cu"
Dim num1Elem As String = "num1Elem", num2Elem As String = "num2Elem"
Dim lneElem As String = "lneElem", nomElem As String = "nomElem"
Dim bol As Boolean
Dim ts1, ts2, ts3, ts4, ts5, ts6 As New Point
Dim t1x, t1y, t2x, t2y, t3x, t3y, t4x, t4y, t5x, t5y, t6x, t6y As Integer
Dim grad As LinearGradientBrush
Const fname As String = "Franklin Gothic Medium"
Dim neFont As New Font(fname, 8.0!, FontStyle.Regular), _
seFont As New Font(fname, 12.0!, FontStyle.Bold), _
lneFont As New Font(fname, 77.0! / 10.0!, FontStyle.Italic), _
nomFont As New Font(fname, 84.0! / 10.0!, FontStyle.Regular), _
numFont As New Font(fname, 9.0!, FontStyle.Regular), _
num2Font As New Font(fname, 8.0!, FontStyle.Regular)
Private Sub Class1_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.HandleCreated
Me.DoubleBuffered = True
Me.SetStyle(ControlStyles.ResizeRedraw, True)
End Sub
Private Sub Class1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles Me.Paint
Draw(e.Graphics)
End Sub
Sub Draw(ByVal G As Graphics)
t1x = CInt(Me.Width / 235.0!)
t1y = CInt(Me.Height / 112.5!)
t2x = CInt(Me.Width / 235.0!)
t2y = CInt(Me.Height / 1.55175!)
t3x = CInt(Me.Width / 940.0!)
t3y = CInt(Me.Height / 2.25!)
t4x = CInt(Me.Width / 1.402985!)
t4y = CInt(Me.Height / 1.60714!)
t5x = CInt(Me.Width / 2.848485!)
t5y = CInt(Me.Height / 112.5!)
t6x = CInt(Me.Width / 1.67857!)
t6y = CInt(Me.Height / 4.090909!)
ts1.X = t1x : ts1.Y = t1y
ts2.X = t2x : ts2.Y = t2y
ts3.X = t3x : ts3.Y = t3y
ts4.X = t4x : ts4.Y = t4y
ts5.X = t5x : ts5.Y = t5y
ts6.X = t6x : ts6.Y = t6y
grad = New LinearGradientBrush(Me.ClientRectangle, Color.AliceBlue, Color.Blue, 0.0!)
G.FillRectangle(grad, Me.ClientRectangle)
G.DrawString(simElem, seFont, Brushes.Black, ts1.X, ts1.Y)
G.DrawString(namElem, neFont, Brushes.Black, ts2.X, ts2.Y)
G.DrawString(lneElem, lneFont, Brushes.Black, ts3.X, ts3.Y)
G.DrawString(nomElem, nomFont, Brushes.Black, ts4.X, ts4.Y)
G.DrawString(num1Elem, numFont, Brushes.Black, ts5.X, ts5.Y)
G.DrawString(num2Elem, num2Font, Brushes.Black, ts6.X, ts6.Y)
End Sub
End Class
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 85