网站建设资讯

NEWS

网站建设资讯

vb.net改变画布颜色,cad怎么改变画布颜色

vb.net控件的BorderStyle设置为FixedSingle会出现黑线边框,可以更改他的颜色吗 比如改成红色线边框

要么重写这个控件的 OnPaint 事件,判断 BorderStyle 属性为 FixedSingle 的时候自绘其他颜色。

创新互联于2013年开始,先为固阳等服务建站,固阳等地企业,进行企业商务咨询服务。为固阳企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

要么不重写,把 BorderStyle 设为 None,直接在这个控件的 Paint 事件里自绘边框,例如:

Private Sub Label1_Paint(sender As Object, e As PaintEventArgs) Handles Label1.Paint

e.Graphics.DrawRectangle(Pens.Red, New Rectangle(Label1.DisplayRectangle.X, Label1.DisplayRectangle.Y, Label1.DisplayRectangle.Width - 1, Label1.DisplayRectangle.Height - 1))

End Sub

运行效果:

vb程序做的图如何改变颜色?不停变换或者点一下变一个都行!

这是随机变的,你可以把过程写在Timer控件里,就自动变了。

Option

Explicit

Private

Sub

Form_click()

BackColor

=

RGB(0,

255,

0)

Width

=

8000

Height

=

8000

Randomize

Cls

Me.ForeColor

=

RGB(Rnd

*

255,

Rnd

*

255,

Rnd

*

255)

Call

drawcircle(ScaleWidth

/

2,

ScaleHeight

/

2,

ScaleWidth

/

6.5)

End

Sub

Private

Sub

drawcircle(x

As

Integer,

y

As

Integer,

r

As

Integer)

Dim

i

As

Integer

If

r

60

Then

Circle

(x,

y),

r

Else

Circle

(x,

y),

r

For

i

=

To

7

Call

drawcircle(x

+

2

*

r

*

Cos(i

*

3.141593

/

4),

y

+

2

*

r

*

Sin(i

*

3.141593

/

4),

r

/

3.5)

Next

i

End

If

End

Sub

在vb.net中,paintcanvas里面填满了颜色,我想通过点击一个按钮来完成清除整个画布内容的效果,

要用GreateGrahpics函数,比如要向 Panel1,填充颜色:

Dim g As Graphic=Panel1.CreateGraphics

Dim b as New Brush(Color.Blue)

g.FillRectangle(b,Panel1)

写的比较粗,意思就是这样的,你可以边看帮助边细细完成

VB中窗体颜色怎么改变?

Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

form1.backcolor = vbRed

endsub

Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

form1.backcolor = vbGreen

end sub

扩展资料:

VB当中的颜色代码

vbBlack H0 黑色

vbRed HFF 红色

vbGreen HFF00 绿色

vbYellow HFFFF 黄色

vbBlue HFF0000 兰色

vbMagenta HFF00FF 洋红

vbCyan HFFFF00 青色

vbWhite HFFFFFF 白色

vbGrayText H80000011 变灰的(无效的)文字

vbButtonText H80000012 揿压按钮上文字的颜色

vbInactiveCaptionText H80000013 非活动标题内文字的颜色

vb3DHighlight H80000014 三维显示元素的高亮颜色

vb3DDKShadow H80000015 三维显示元素的最暗阴影颜色

vb3DLight H80000016 低于 vb3Dhighlight 的 三维次高亮颜色

vb3DFace H8000000F 文字表面的颜色

vb3DShadow  H80000010 文字阴影的颜色

vbInfoText H80000017 提示窗内文字的颜色

vbInfoBackground H80000018 提示窗内背景的颜色

VB.NET设置屏幕分辨率、颜色位数、刷新率 实例代码

这篇文章介绍了VB.NET设置屏幕分辨率、颜色位数、刷新率

实例代码,有需要的朋友可以参考一下

复制代码

代码如下:

Private

Declare

Function

GetDeviceCaps

Lib

"gdi32"

(ByVal

hdc

As

Long,

ByVal

nIndex

As

Long)

As

Long

Private

Declare

Function

ChangeDisplaySettings

Lib

"user32"

Alias

"ChangeDisplaySettingsA"

(lpDevMode

As

Any,

ByVal

dwflags

As

Long)

As

Long

Private

Const

CCDEVICENAME

As

Long

=

32

Private

Const

CCFORMNAME

As

Long

=

32

Private

Const

DM_BITSPERPEL

As

Long

=

H40000

Private

Const

DM_PELSWIDTH

As

Long

=

H80000

Private

Const

DM_PELSHEIGHT

As

Long

=

H100000

Private

Const

DM_DISPLAYFLAGS

As

Long

=

H200000

Private

Const

DM_DISPLAYFREQUENCY

=

H400000

Private

Const

CDS_FORCE

As

Long

=

H80000000

Private

Const

BITSPIXEL

As

Long

=

12

Private

Const

HORZRES

As

Long

=

8

Private

Const

VERTRES

As

Long

=

10

Private

Const

VREFRESH

=

116

Private

Type

DEVMODE

dmDeviceName

As

String

*

CCDEVICENAME

dmSpecVersion

As

Integer

dmDriverVersion

As

Integer

dmSize

As

Integer

dmDriverExtra

As

Integer

dmFields

As

Long

dmOrientation

As

Integer

dmPaperSize

As

Integer

dmPaperLength

As

Integer

dmPaperWidth

As

Integer

dmScale

As

Integer

dmCopies

As

Integer

dmDefaultSource

As

Integer

dmPrintQuality

As

Integer

dmColor

As

Integer

dmDuplex

As

Integer

dmYResolution

As

Integer

dmTTOption

As

Integer

dmCollate

As

Integer

dmFormName

As

String

*

CCFORMNAME

dmUnusedPadding

As

Integer

dmBitsPerPel

As

Integer

dmPelsWidth

As

Long

dmPelsHeight

As

Long

dmDisplayFlags

As

Long

dmDisplayFrequency

As

Long

End

Type

Private

Sub

cmdChangeDesktopMode_Click()

Dim

DM

As

DEVMODE

With

DM

.dmPelsWidth

=

CInt(txtNewWidth.Text)

.dmPelsHeight

=

CInt(txtNewHeight.Text)

.dmBitsPerPel

=

CInt(txtNewColor.Text)

.dmDisplayFrequency

=

CInt(txtNewFreq.Text)

.dmFields

=

DM_PELSWIDTH

Or

DM_PELSHEIGHT

Or

DM_BITSPERPEL

Or

DM_DISPLAYFREQUENCY

.dmSize

=

LenB(DM)

End

With

If

ChangeDisplaySettings(DM,

CDS_FORCE)

Then

MsgBox

"错误!不支持此模式!"

End

If

End

Sub

Private

Sub

Form_Load()

txtOldWidth.Text

=

GetDeviceCaps(Me.hdc,

HORZRES)

txtOldHeight.Text

=

GetDeviceCaps(Me.hdc,

VERTRES)

txtOldColor.Text

=

GetDeviceCaps(Me.hdc,

BITSPIXEL)

txtOldFreq.Text

=

GetDeviceCaps(Me.hdc,

VREFRESH)

End

Sub

VB.net 旋转图像时,如何指定填充色

绘制线条采用Draw开头的方法,颜色参数用Pen类;

绘制有填充色的封闭图形采用Fill开头的方法,颜色参数用Brush类;

例如:

'绘制一个实心圆,该圆在:直线x=200,y=200,x=200+100,y=200+100所划矩形区域内

Me.CreateGraphics.FillEllipse(New SolidBrush(Color.Orange), 200, 200, 100, 100)

'绘制一个空心圆,该圆在:直线x=200,y=200,x=200+100,y=200+100所划矩形区域内

Me.CreateGraphics.DrawEllipse(New Pen(Color.Black), 200, 200, 100, 100)


新闻名称:vb.net改变画布颜色,cad怎么改变画布颜色
文章源于:http://cdweb.net/article/dscicdd.html