⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcanvassize.frm

📁 一款开源的完整矢量绘图控件源码,支持直线、弧线、矩形、圆角矩形、椭圆、多边形、星形、文本和图片等的绘制
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCanvasSize 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "画布大小"
   ClientHeight    =   1650
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4020
   Icon            =   "frmCanvasSize.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1650
   ScaleWidth      =   4020
   StartUpPosition =   1  '所有者中心
   Begin VB.OptionButton OpType 
      Caption         =   "毫米(&M)"
      Height          =   240
      Index           =   2
      Left            =   2295
      TabIndex        =   7
      Top             =   765
      Width           =   1500
   End
   Begin VB.OptionButton OpType 
      Caption         =   "英寸(&I)"
      Height          =   240
      Index           =   1
      Left            =   2295
      TabIndex        =   6
      Top             =   495
      Width           =   1500
   End
   Begin VB.OptionButton OpType 
      Caption         =   "缇(&T)"
      Height          =   240
      Index           =   0
      Left            =   2295
      TabIndex        =   5
      Top             =   225
      Value           =   -1  'True
      Width           =   1500
   End
   Begin VB.CommandButton BtnOk 
      Caption         =   "确定(&O)"
      Height          =   375
      Left            =   1215
      TabIndex        =   4
      Top             =   1125
      Width           =   1590
   End
   Begin VB.TextBox TxtWidth 
      Alignment       =   1  'Right Justify
      Height          =   330
      Left            =   1125
      TabIndex        =   1
      Text            =   "640"
      Top             =   630
      Width           =   690
   End
   Begin VB.TextBox TxtHeight 
      Alignment       =   1  'Right Justify
      Height          =   330
      Left            =   1125
      TabIndex        =   0
      Text            =   "480"
      Top             =   225
      Width           =   690
   End
   Begin VB.Label Label2 
      Caption         =   "宽度(&W):"
      Height          =   285
      Left            =   225
      TabIndex        =   3
      Top             =   675
      Width           =   825
   End
   Begin VB.Label Label1 
      Caption         =   "高度(&H):"
      Height          =   240
      Left            =   225
      TabIndex        =   2
      Top             =   270
      Width           =   780
   End
End
Attribute VB_Name = "frmCanvasSize"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'http://www.cnpopsoft.com [华普软件汉化]
'发布日期:2007/08/07
'描    述:矢量绘图控件示例
'网    站:http://www.Mndsoft.com/  (VB6源码博客)
'网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
'e-mail  :Mndsoft@163.com
'e-mail  :Mndsoft@126.com
'OICQ    :88382850
'          如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Option Explicit

Dim myH As Single
Dim myW As Single

Private Sub BtnOk_Click()
    On Error GoTo Err1
    frmMain.ObjDraw1.CanvasHeight = myH
    frmMain.ObjDraw1.CanvasWidth = myW
    Unload Me
    Exit Sub
Err1:
    frmMain.ObjDraw1.CanvasHeight = 480
    frmMain.ObjDraw1.CanvasWidth = 640
    Unload Me
End Sub

Private Sub Form_Load()
    myH = frmMain.ObjDraw1.CanvasHeight
    myW = frmMain.ObjDraw1.CanvasWidth
    TxtHeight.Text = myH
    TxtWidth.Text = myW
End Sub

Private Sub OpType_Click(Index As Integer)
    Select Case Index
    Case 0
        TxtWidth.Text = myW
        TxtHeight.Text = myH
    Case 1
        TxtWidth.Text = ScaleX(myW, vbPixels, vbInches)
        TxtHeight.Text = ScaleY(myH, vbPixels, vbInches)
    Case 2
        TxtWidth.Text = ScaleX(myW, vbPixels, vbMillimeters)
        TxtHeight.Text = ScaleY(myH, vbPixels, vbMillimeters)
    End Select
End Sub

Private Sub TxtHeight_Change()
    On Error Resume Next
    If OpType(1).Value = True Then
        myH = ScaleY(TxtHeight.Text, vbInches, vbPixels)
    ElseIf OpType(2).Value = True Then
        myH = ScaleY(TxtHeight.Text, vbMillimeters, vbPixels)
    Else
        myH = TxtHeight.Text
    End If
End Sub

Private Sub TxtWidth_Change()
    On Error Resume Next
    If OpType(1).Value = True Then
        myW = ScaleX(TxtWidth.Text, vbInches, vbPixels)
    ElseIf OpType(2).Value = True Then
        myW = ScaleX(TxtWidth.Text, vbMillimeters, vbPixels)
    Else
        myW = TxtWidth.Text
    End If
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -