如何构造背景透明的窗体

prok 2003-10-13 10:10:55
如何能做出像word助手那样的背景透明的窗体(或者那不是窗体?)也就是说怎么才能显示一个背景透明的图案
...全文
71 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
prok 2003-10-19
  • 打赏
  • 举报
回复
搞定了。要用gdi绘上去,用插入背景是不行的。
VirtualDesktop 2003-10-18
  • 打赏
  • 举报
回复
用API啊
thelostman 2003-10-18
  • 打赏
  • 举报
回复
你这是不规则窗体的问题
lzg530 2003-10-15
  • 打赏
  • 举报
回复
To-realwolf(wolf)
像你们那样做根本就行不通,你的button1在透明窗体中怎么触发,根本就不能显示button按钮
用一下 .Image.Dispose试一试
prok 2003-10-15
  • 打赏
  • 举报
回复
binbin2000(binbin) 看清我的问题ok?
binbin2000 2003-10-15
  • 打赏
  • 举报
回复
form.Opacity = 0%
prok 2003-10-15
  • 打赏
  • 举报
回复
256色?用firework什么的试了一下好象没有这个设置把?8位bmp和24位bmp而已。
prok 2003-10-14
  • 打赏
  • 举报
回复
这些办法不是我想要的。我是想把图案周围的地方透明。也就是显示的时候是一个不规则的窗体(利用像素透明)。vb.net里有一个属性可以把某一像素透明处理,可我在背景添加图片把图案的背景像素颜色设为透明的颜色却不起作用了。教程上说可以这样做。请高手指点正确做法
prok 2003-10-14
  • 打赏
  • 举报
回复
试试。多谢!!
realwolf 2003-10-14
  • 打赏
  • 举报
回复
颜色不纯,不是256色
realwolf 2003-10-14
  • 打赏
  • 举报
回复
换一张bmp的图片实验实验。
realwolf 2003-10-14
  • 打赏
  • 举报
回复
肯定可以:
看代码

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

Public Sub New()
MyBase.New()

'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()

'在 InitializeComponent() 调用之后添加任何初始化

End Sub

'窗体重写处置以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer

'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(176, 192)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(48, 40)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(192, 56)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 32)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Label1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.Button1})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TransparencyKey = Color.Black

End Sub
End Class
prok 2003-10-14
  • 打赏
  • 举报
回复
试了。我把一个背景是black的gif图片插入当背景图片。把transparencykey=black。根本没用
realwolf 2003-10-14
  • 打赏
  • 举报
回复
利用窗体的transparencykey=屏蔽色,就可以了。
boyors 2003-10-13
  • 打赏
  • 举报
回复
dot net里面有这个属性,在窗体里的一个什么100%的改一下就可以了。
zwq78 2003-10-13
  • 打赏
  • 举报
回复
设置窗体的Opacity 属性
Private Sub CreateMyOpaqueForm()
' Create a new form.
Dim form2 As New Form()
' Set the text displayed in the caption.
form2.Text = "My Form"
' Set the opacity to 75%.
form2.Opacity = 0.75
' Size the form to be 300 pixels in height and width.
form2.Size = New Size(300, 300)
' Display the form in the center of the screen.
form2.StartPosition = FormStartPosition.CenterScreen

' Display the form as a modal dialog box.
form2.ShowDialog()
End Sub
shclhs 2003-10-13
  • 打赏
  • 举报
回复
API中有这个函数

手中现在没东西,没法给你

16,553

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧