掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Formの透過で? (ID:123854)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
魔界の仮面弁士さん、ありがとうございます。 >なお、TransparencyKey や Opacity は、Windows 2000以降の >レイヤード ウィンドウ機能を利用しているはずなので、 >Layerd Windowの制限を越える表現はできないかと思います。 それは知っています。 半透明を利用したアルファーブレンドはWindows 2000以降でしか サポートされていないのは把握しています。 でも、完全に透過なら、Wijndows 98以降からサポートされていたような 記憶が・・・・・ ソフトをフリーで配布するときに推奨環境にWindows2000以降と 書いておけば、問題ないですし・・・・・ ># 全体を半透明にしつつ、不透明な部分を残したいという事になると、 ># 不透明ウィンドウと半透明ウィンドウを重ね合わせて表現する、とか。 やっぱり、不可能なんですね。 なかなか、このようなアイデアが思いつかなかったです。 ソースは下に記載します。 でも、ContextMenuを使う場合、コーティングが、大変なことになりますが・・・・・・・ 'Form2を1つ追加してください。 '---------------------------モジュール----------------------------- Module ReForm 'ウィンドウの大きさ Public FW As Integer Public FH As Integer '枠の大きさ Public TW As Integer 'タスクバーの高さ Public TH As Integer 'フォームの背景色 Public FormColor As Color End Module '--------------------------Form1のClass----------------------------- Dim frm2 As Form2 = Nothing Dim kiroku As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load kiroku = Me.FormBorderStyle Me.FormBorderStyle = FormBorderStyle.None FW = Me.Width FH = Me.Height Me.FormBorderStyle = kiroku TW = (Me.Width - FW) / 2 TH = Me.Height - (FH + TW) FormColor = Me.BackColor frm2 = New Form2 frm2.Owner = Me frm2.Show() frm2.Top = Me.Top + TH frm2.Left = Me.Left + TW Call Draw(frm2) End Sub Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Move If Not frm2 Is Nothing Then frm2.Top = Me.Top + TH frm2.Left = Me.Left + TW End If End Sub Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing If Not frm2 Is Nothing Then With frm2 .Close() .Dispose() End With frm2 = Nothing End If End Sub '------------------------------------モジュール----------------------------------------- Module byouga Public Sub Draw(ByVal Form As Form) '文字を描画する Dim g As Graphics = Nothing Dim burasi As Brush = Nothing g = Form.CreateGraphics burasi = New SolidBrush(Color.FromArgb(0, 0, 0)) g.DrawString("Test", Form.Font, burasi, 50, 50) If Not burasi Is Nothing Then burasi.Dispose() burasi = Nothing End If If Not g Is Nothing Then g.Dispose() g = Nothing End If End Sub End Module '-------------------------------Form2のClass--------------------------------------------- Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.FormBorderStyle = FormBorderStyle.None Me.Size = New Size(FW, FH) Me.BackColor = FormColor Me.ShowInTaskbar = False '透明を指定する Me.TransparencyKey = Me.BackColor End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.