vbide:VB对IDE环境的扩展



VB、Delphi作为Windows下可视化编程环境已被大家广为采用笔者在编程中通过对 2者IDE开发环境比较利用VBAddIn接口完全模拟了Delphi对组Control控件位置、大小快速操作和模板功能对VB开发环境作了个有益扩展大大提高了VB速度和方便性

、Control控件
1、Control控件对齐(Alignment)
在VB编程中From上单个Control控件位置、大小虽可方便调整但对组Control控件位置关系、尺寸关系却难以自如操作而Delphi中有Align、Size提供了此功能对用户来说非常方便笔者再编程过程中就常常遇到这样问题笔者通过编程成功模拟了Delphi这功能

a、完成功能
b、编程思想
化系统和变量

SetTheseControls=
VBInstance.ActiveProject.ActiveForm.SelectedControlTemplates
选择对齐方式
ForEachControlInTheseControls
iCount=iCount+1
SetMinHorControl=MinHou(Control)
SetMaxHorControl=MaxHor(Control)
SetMinVerControl=MinVer(Control)
SetMaxVerControl=MaxVer(Control)
SetHorControls(iCount1)=SortHorControl(Control)
SetVerControls(iCount1)=SortVerControl(Control)
NextControl
计算Control控件位移
ForI=0ToiCount1
HorControl(I).Properties(“Left”)=新值
HorControl(I).Properties(“Width”)=新值

VerControl(I).Properties(“Top”)=新值
VerControl(I).Properties(“Height”)=新值
NextI
ExitSub
2、Control控件尺寸(Size)
a、完成功能
b、编程思想
化系统和变量
SetTheseControls=
VBInstance.ActiveProject.ActiveForm.SelectedControlTemplates
选择尺寸变换方式
ForEachControlInTheseControls
iCount=iCount+1
MinWidth=MinWidth(Control)
MaxWidth=MaxWidth(Control)
MinHeight=MinHeight(Control)
MaxHeight=MaxHeight(Control)

SetControls(iCoun1)=Control
NextControl

ForI=0ToiCount1
Countrol(I).Properties(“Width”)=MinWidthORMaxWidth
Countrol(I).Properties(“Height”)=MinHeightORMaxHeight
NextI
ExitSub
2、模板
各种字处理软件Software现在均提供了模板功能Delphi也提供了Gallery功能提供了些模板来降低用户编程重复性笔者也对VB提供了这个功能
化系统和变量

SetfrmNewForm=IDEApp.ActiveProject.AddFormTemplate
OnErrorResumeNext
ForI=0TofrmNewForm.Properties.Count1
PropName=frmNewForm.Properties(I).Name
If(InStr(“NameLeftTop”PropName)0)Then
frmNewForm.Properties(I).Value=fnGetProperty(tuForm.ropName)
EndIf
NextI

ForEachControlIntuForm.Controls
ControlTypeName=fnGetControlTypeName(Control)
WithfrmNewForm.ControlTemplates.Add(ControlTypeName)


ForI=0To.Properties.Count1
PropName=.Properties(I).Name
.Properties(I).Value=fnGetProperty(Control,PropName)
NextI
EndWith
NextControl

fnHandle=FreeFile
OpenApp.Path&“\DesiTemp.MOD”ForOutputAsfnHandle
tuForm.prWriteFormCodefnHandle
ClosefnHandle
frmNewForm.InsertFileApp.Path&“\DesiTemp.MOD”
KillApp.Path&“\DesiTemp.MOD”
OnErrorGoTo0
ExitSub
Tags:  pci的ide扩展卡 ide扩展 ide扩展卡 vbide

延伸阅读

最新评论

发表评论