transparentkey不用担心 [英] transparentkey not woriking

查看:115
本文介绍了transparentkey不用担心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在创建一个从Form类继承的类.我想将此课程作为一个图标.我想知道的是transparentkey在那儿工作.谁能告诉我原因以及如何解决?
先谢谢你.

我的英语不好,如果我对我的问题没有提供足够的信息,对不起.

:)

拉努特先生

我班上的代码在这里

 公共  frmItem
    继承表格
    私有  frmItem_Load( ByVal  s 目标 对象 ByVal  e  As  System.EventArgs) MyClass  .Load
         MyClass  .ShowInTaskbar = 错误: MyClass . TopMost = 
         MyClass  .FormBorderStyle = Windows.Forms.FormBorderStyle.None

         MyClass .宽度=  50 : MyClass .身高=  50 
         MyClass  .BackColor = Color.Lime: MyClass  .TransparencyKey = Color.Lime

         MyClass  .Top = Screen.PrimaryScreen.WorkingArea.Height- MyClass  .Height
         MyClass  .Left = Screen.PrimaryScreen.WorkingArea.Width- MyClass  .Width

         MyClass  .BackgroundImage = My.Resources.openshareicon1
         MyClass  .BackgroundImageLayout = ImageLayout.Zoom

         MyClass .不透明度=  0 . 5 
    结束 

    私有  frmItem_MouseClick( ByVal 发​​件人目标 对象 ByVal  e 句柄 结束
    结束 
    私有  frmItem_MouseHover(> ByVal 发​​件人目标 对象 ByVal  e 句柄  MyClass .不透明度=  1 
    结束 
    私有  frm_MouseLeave( ByVal 发​​件人目标 对象 ByVal  e 句柄  MyClass .不透明度=  0 . 5 
    结束 
结束  

解决方案

表格的透明度非常有限,它会使图形有些慢.您所要做的就是使用System.Windows.Forms.Form.OpacitySystem.Windows.Forms.Form.TransparencyKey.第一种方法使所有表单均一地半透明(具有所有子控件的表单具有相同的不透明度),另一种方法使所有的表单都只是一种确切的颜色透明.仅此而已,别无所求.

-SA


您是否要尝试 [ ^ ] ?? blockquote>

hi all,
i am creating a class inherited from a Form Class. i want to make this class as an icon. what i was wondering is that the transparentkey is working there. can anyone tell me why and how to fix it?
thanks before hand.

my english is not good, sorry if i don''t give enough information about my question.

:)

Mr. Ranuth

the code of my class here

Public Class frmItem
    Inherits Form
    Private Sub frmItem_Load(ByVal s As Object, ByVal e As System.EventArgs) Handles MyClass.Load
        MyClass.ShowInTaskbar = False : MyClass.TopMost = True
        MyClass.FormBorderStyle = Windows.Forms.FormBorderStyle.None

        MyClass.Width = 50 : MyClass.Height = 50
        MyClass.BackColor = Color.Lime : MyClass.TransparencyKey = Color.Lime

        MyClass.Top = Screen.PrimaryScreen.WorkingArea.Height - MyClass.Height
        MyClass.Left = Screen.PrimaryScreen.WorkingArea.Width - MyClass.Width

        MyClass.BackgroundImage = My.Resources.openshareicon1
        MyClass.BackgroundImageLayout = ImageLayout.Zoom

        MyClass.Opacity = 0.5
    End Sub

    Private Sub frmItem_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
        End
    End Sub
    Private Sub frmItem_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyClass.MouseHover
        MyClass.Opacity = 1
    End Sub
    Private Sub frm_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyClass.MouseLeave
        MyClass.Opacity = 0.5
    End Sub
End Class

解决方案

Transparency for Forms is very limited and it makes graphics somewhat slow. All you have to do is using System.Windows.Forms.Form.Opacity or System.Windows.Forms.Form.TransparencyKey. First method makes all form uniformly semi-transparent (the form with all children controls having the same opacity), another method make transparent just one exact color. That''s all, nothing fancy can be done.

—SA


Are you trying to do this[^]??


这篇关于transparentkey不用担心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆