开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 3910|回复: 6
收起左侧

[C#源码] 玩点效果C#透明+++??/效果 字节流?

[复制链接]
结帖率:33% (3/9)
发表于 2012-11-30 19:37:05 | 显示全部楼层 |阅读模式   四川省成都市
2.png
C#透明效果
字节流运算集
3.png
1.png
1.png
1.png
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using SkinSharp;
  10. using System.IO;
  11. namespace My_Software
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.         SkinH_Net Skin_Net = new SkinH_Net();
  20.         int Hwnd = new int();
  21.         [System.Runtime.InteropServices.DllImport("user32.dll",EntryPoint= "MessageBoxA")]
  22.         private static extern int MessageBoxA(int Hwnd, string Tip, string Text, int val);
  23.         // 信息框
  24.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "FindWindowA")]
  25.         private static extern int FindWindowA(string lpClassName, string lpWindowName);
  26.         // Class&&Name 取Form句柄
  27.         [System.Runtime.InteropServices.DllImport("SetDiaphaneity.dll", EntryPoint = "SetDiaphaneity")]
  28.         private static extern int SetDiaphaneity(int a, int b);
  29.         // Class&&Name 取Form句柄
  30.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetWindowPos")]
  31.         private static extern int SetWindowPos(int Long, int LongA, int LongB, int LongC, int LongD, int LongE, int LongF);
  32.         // 设置窗口位置
  33.         private void Form1_Load(object sender, EventArgs e)
  34.         {
  35.             this.Text = "使用信息框弹出消息小案例";
  36.             this.button1.Text = "Open(&O)";
  37.             this.openFileDialog1.FileName = "(请选择您欲选择的文件)";
  38.             string namespaceAbc = ".she";
  39.             Random ran=new Random();
  40.             int Random = ran.Next(1, 3); // 取随机数不知是否为置入随机数种子为系统时间这个Random的置随机数种子命令函数不知道望高人指点一二
  41.             switch (Random) // 80%语言switch不可以直接提供返回值函数求值需装入变量后继续
  42.             {
  43.                 case 1:
  44.                     namespaceAbc = ("Aero").ToString() + (string)namespaceAbc;
  45.                     break;
  46.                 case 2:
  47.                     namespaceAbc = ("QQ2008").ToString() + (string)namespaceAbc;
  48.                     break;
  49.                 default:
  50.                     namespaceAbc = ("skinh").ToString() + (string)namespaceAbc;
  51.                     break;
  52.             }
  53.             this.Skin_Net.AttachEx(namespaceAbc, "");
  54.             this.Skin_Net.SetAero(-1);
  55.             this.openFileDialog1.Filter = "*.Txt|*.txt|*.Ini|*.ini|*.Cfg|*.cfg|*.Inf|*.inf|*.All|*.*"; // 对话框文件过滤器
  56.             string []Cm=new string [2];
  57.             Cm[1]=this.Text;
  58.             Hwnd = FindWindowA(Cm[0], Cm[1]);
  59.             this.openFileDialog1.Title = "OpenFileDialog";
  60.             this.openFileDialog1.DefaultExt = "";
  61.             SetTouMing(Hwnd,-1,128,2);
  62.             // SetDiaphaneity(Hwnd, 188); 额如果使用该接口函数那么就得程序挂起
  63.             SetWindowPos(Hwnd, -1, 0, 0, 0, 0, 3);
  64.             // 设置窗口总在最前
  65.             // 使用本代码可能造成窗口标题栏脱变
  66.             // 存在于Skin#下、
  67.             AnimateWindow(Hwnd, 1288, 22);

  68.         }

  69.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetWindowLongA")]
  70.         private static extern int GetWindowLongA(int hwnd, int nIndex);
  71.         // 获取窗口信息
  72.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetWindowLongA")]
  73.         private static extern int SetWindowLongA(int hwnd, int nIndex, int dwNewLong);
  74.         // 设置窗口信息
  75.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetLayeredWindowAttributes")]
  76.         private static extern int SetLayeredWindowAttributes(int hwnd, int crKey, int alrf, int dwFlags);
  77.         // 设置透明函数
  78.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "AnimateWindow")]
  79.         private static extern int AnimateWindow(int hwnd, int dwTime, int dwFlags);
  80.         // 动画窗口
  81.         bool SetTouMing(int CHwnd,int CrKey,int bAlpha,int dwFlags)
  82.         {
  83.             int Ret = new int();
  84.             Ret = GetWindowLongA(CHwnd, -20);
  85.             Ret = Ret | 524288;
  86.             SetWindowLongA(CHwnd, -20, Ret);
  87.             if (SetLayeredWindowAttributes(CHwnd, CrKey, bAlpha, dwFlags) != 0)
  88.             {
  89.                 return true;
  90.             }
  91.             return false;
  92.         }
  93.         [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "FlashWindow")]
  94.         private static extern int FlashWindow(int Hwnd, bool dwY);
  95.         private void button1_Click(object sender, EventArgs e)
  96.         {
  97.             string flieName;
  98.             if (this.openFileDialog1.ShowDialog() == DialogResult.OK) // 对话框.打开显示 == 对话框返回如果是确认钮 所谓 True
  99.             {
  100.                 flieName = this.openFileDialog1.FileName; // 将对话框中的文件名返回到变量
  101.                 StreamReader flieStream = new StreamReader(flieName, System.Text.Encoding.Default); // 初始化字节集流对象..编码为系统当前默认Ausic码
  102.                 flieName = flieStream.ReadToEnd()+Environment.NewLine; //从首读到尾 And 换行符
  103.                 int rtr = MessageBoxA(Hwnd, flieName, "信息:", 64 + 1);
  104.                 // if rtr = 1 确认被单击 And 2 取消==关闭钮
  105.                 flieStream.Close();// 关闭字节流对象
  106.                 FlashWindow(Hwnd, true);
  107.             }
  108.             else
  109.             {
  110.                 MessageBoxA(Hwnd, "您点击了取消所以执行Commonde失败", "信息:", 64);
  111.             }
  112.         }
  113.     }
  114. }
复制代码
My Software.rar (440.57 KB, 下载次数: 6)

点评

窗口最前啊。。。   四川省成都市  发表于 2012-11-30 19:37
结帖率:33% (3/9)
发表于 2013-2-27 21:08:31 | 显示全部楼层   江苏省宿迁市
谢谢 正需要 看看
回复 支持 反对

使用道具 举报

发表于 2013-2-26 16:47:04 | 显示全部楼层   广东省佛山市
哇哦,LZ大手子哇。{:soso_e102:}
回复 支持 反对

使用道具 举报

发表于 2013-2-24 08:53:16 | 显示全部楼层   河南省驻马店市
下载后VS2008打不开
回复 支持 反对

使用道具 举报

签到天数: 6 天

发表于 2013-2-17 16:32:48 | 显示全部楼层   河南省驻马店市
哦...这个...偶昨天就看了....
回复 支持 反对

使用道具 举报

结帖率:33% (3/9)
 楼主| 发表于 2012-11-30 19:47:51 | 显示全部楼层   四川省成都市
记忆是座荒岛 发表于 2012-11-30 19:45
刷主题必备法宝

// SetDiaphaneity(Hwnd, 188); 额如果使用该接口函数那么就得程序挂起
直接调用易语言的支持库有概率吗
回复 支持 反对

使用道具 举报

结帖率:100% (12/12)
发表于 2012-11-30 19:45:07 | 显示全部楼层   广东省珠海市
             刷主题必备法宝

点评

饿...不要以为 设置窗口透明度是初级命令 他准确的说是高级命令 C#无法调用   四川省成都市  发表于 2012-11-30 19:46
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 诚聘英才| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 800073686,邮箱:800073686@b.qq.com
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表