gimpei @Wiki

見た目スキンその2

最終更新:

匿名ユーザー

- view
だれでも歓迎! 編集
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices ;  // for DllImport


namespace Muno0._1
{
/// <summary>
/// subForm の概要の説明です。
/// </summary>
public class subForm : System.Windows.Forms.Form
{
private System.ComponentModel.IContainer components;

//*****各種DLL読み込み
[DllImport("user32.dll")]
extern static int GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId) ;

[DllImport("user32.dll")]
extern static IntPtr GetForegroundWindow() ;

[DllImport("user32.dll")]
extern static bool AttachThreadInput(int idAttach, int idAttachTo, bool fAttach) ;

//*****各種DLLの読み込み終わり

//***2次グローバル変数の定義
private Point mMousePoint;
int t2c=0,m_x=0,m_y=0,giHour=0,giMinute=0;
bool m_drag=false;
bool opBool=false;
bool m_dm=false;
bool m_down=false;
bool contrast=false;
int mouse_X ;
int mouse_Y ;
private System.Windows.Forms.Timer RefreshTime;
int form_move_start = 0 ;
public subForm()
{
//
// Windows フォーム デザイナ サポートに必要です。
//
InitializeComponent();

//
// TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
//
}

/// <summary>
/// 使用されているリソースに後処理を実行します。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows フォーム デザイナで生成されたコード
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(subForm));
this.RefreshTime = new System.Windows.Forms.Timer(this.components);
//
// RefreshTime
//
this.RefreshTime.Enabled = true;
this.RefreshTime.Interval = 1000;
this.RefreshTime.Tick += new System.EventHandler(this.RefreshTime_Tick);
//
// subForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
this.BackColor = System.Drawing.Color.Blue;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(179, 237);
this.ControlBox = false;
this.ForeColor = System.Drawing.Color.Blue;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "subForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.TransparencyKey = System.Drawing.Color.Blue;
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form2_MouseDown);
this.Load += new System.EventHandler(this.subForm_Load);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form2_MouseMove);

}
#endregion

private void subForm_Load(object sender, System.EventArgs e)
{
this.SetStyle(
ControlStyles.DoubleBuffer |         // 描画をバッファで実行する
ControlStyles.UserPaint |            // 描画は(OSでなく)独自に行う
ControlStyles.AllPaintingInWmPaint,  // WM_ERASEBKGND を無視する
true                                 // 指定したスタイルを適用「する」
) ;
//フォームのある一定の色を透明にする
this.TransparencyKey = Color.Blue;//青 (システム定義色による指定)
}



//###########################################################################################################################
private void Form2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
//左クリックの場合のみ位置を記憶
mMousePoint = new Point(-e.X, -e.Y);
}
}

private void Form2_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
//フォームの移動
this.SetDesktopLocation(this.Left + mMousePoint.X + e.X, this.Top + mMousePoint.Y + e.Y);
}
}
        //##############################################################################################################################################

private void RefreshTime_Tick(object sender, System.EventArgs e)
{
//フォームのある一定の色を透明にする
this.TransparencyKey = Color.Blue;//青 (システム定義色による指定)

/*
if(this.Opacity==50)
{
this.contrast=true;
}
else if(this.Opacity==100)
{
this.contrast=false;
}

if(this.contrast==true)
{
this.Opacity++;
}
else if(this.contrast==false)
{
this.Opacity--;
}
*/
//this.Opacity=this.Opacity -1;

}



}
}

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

目安箱バナー