VS2013 图片背景·全透明背景图(转)

1.准备工作
http://download.microsoft.com/download/9/1/0/910EE61D-A231-4DAB-BD56-DCE7092687D5/vssdk_full.exe
http://pan.baidu.com/s/1kTFt3gz
2.新建Package项目
代码如下:
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace Microsoft.SoheeBackground//命名空间自己修改回自己用的
{
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112","1.0", IconResourceID = )]
//此处删除了一条代码段,原因不明,对后续影响不明
[ProvideAutoLoad(UIContextGuids.NoSolution)]
[ProvideAutoLoad(UIContextGuids.SolutionExists)]
public sealed class IDEBackgroundPackage : Package
{
protected override void Initialize()
{
base.Initialize();
Application.Current.MainWindow.Loaded += MainWindow_Loaded;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
var rWindow = (Window)sender;
//加载图片 E:\FileDownload\Explorer\be30870a304e251ff3c5926fa786c9177f3e537f.jpg
var rImageSource = BitmapFrame.Create(new Uri(@"E:\FileDownload\Explorer\241f95cad1c8a786d814d6eb6709c93d70cf501c.jpg"/*图片路径*/), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
rImageSource.Freeze();
var rImageControl = new Image()
{
Source = rImageSource,
Stretch =Stretch.UniformToFill, //按比例填充
HorizontalAlignment =HorizontalAlignment.Center, //水平方向中心对齐
VerticalAlignment =VerticalAlignment.Center, //垂直方向中心对齐
};
Grid.SetRowSpan(rImageControl, );
var rRootGrid =(Grid)rWindow.Template.FindName("RootGrid", rWindow);
rRootGrid.Children.Insert(, rImageControl);
}
}
}
5.代码修改后,调试,这时就会编译扩展,然后启动实验用VS。(如果这是第一次启动实验用VS,可能要像刚安装完VS那样设置一下)接着你会看到角落处显现出那张背景图
3.修改皮肤配色
https://visualstudiogallery.msdn.microsoft.com/9e08e5d3-6eb4-4e73-a045-6ea2a5cbdabe

4.重启,重启后,进入“工具->CustomizeColors”。在“Customize Colors”那里点“Import Theme”即可(文件在一开始百度云下载的打包文件中)
4.编辑器透明化
using Microsoft.VisualStudio.Text.Classification; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Utilities; using System; using System.ComponentModel.Composition; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Threading; namespace Microsoft.SoheeBackground
{ [Export(typeof(IWpfTextViewCreationListener))] [ContentType("Text")] [ContentType("BuildOutput")] [TextViewRole(PredefinedTextViewRoles.Document)] class Listener :IWpfTextViewCreationListener { [Import] IEditorFormatMapService EditorFormatMapService = null; public void TextViewCreated(IWpfTextView rpTextView) { new EditorBackground(rpTextView); //去掉断点边栏的背景 var rProperties = EditorFormatMapService.GetEditorFormatMap(rpTextView).GetProperties("IndicatorMargin"); rProperties["BackgroundColor"] = Colors.Transparent; rProperties["Background"]= Brushes.Transparent; } } class EditorBackground { IWpfTextView r_TextView; ContentControl r_Control; Grid r_ParentGrid; Canvas r_ViewStack; public EditorBackground(IWpfTextView rpTextView) { r_TextView = rpTextView; r_Control =(ContentControl)r_TextView; r_TextView.Background =Brushes.Transparent; r_TextView.BackgroundBrushChanged+= TextView_BackgroundBrushChanged; r_TextView.Closed +=TextView_Closed; r_Control.Loaded += TextView_Loaded; } void MakeBackgroundTransparent() { r_TextView.Background =Brushes.Transparent; r_ViewStack.Background =Brushes.Transparent; r_ParentGrid.ClearValue(Grid.BackgroundProperty); } void TextView_Loaded(object sender,RoutedEventArgs e) { if (r_ParentGrid == null) r_ParentGrid =(Grid)r_Control.Parent; if (r_ViewStack == null) r_ViewStack = (Canvas)r_Control.Content; MakeBackgroundTransparent(); } void TextView_BackgroundBrushChanged(object sender, BackgroundBrushChangedEventArgs e) { r_Control.Dispatcher.BeginInvoke(new Action(() => { while (r_ParentGrid.Background != null) MakeBackgroundTransparent(); }), DispatcherPriority.Render); } void TextView_Closed(object sender,EventArgs e) { //清除委托,以防内存泄露 r_TextView.Closed -=TextView_Closed; r_TextView.BackgroundBrushChanged-= TextView_BackgroundBrushChanged; } } }
PS:参考
1.http://startalkers.lofter.com/post/1cb119b5_5be5e5a
2.http://doc.okbase.net/u012915516/archive/124296.html
VS2013 图片背景·全透明背景图(转)的更多相关文章
- vscode 全透明背景图
一.前言 08.02更新:已魔改插件 可以直接下载插件使用了 10.18跟新:已发布到vscode扩展 下载地址 下载后手动安装就ok了,具体配置安装后点开插件有说明的!!! 今天看到了博客园 这篇 ...
- painter半透明的 底层窗口全透明背景
- css实现背景全透明样式
background-color:transparent; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFF ...
- IE6下png背景不透明——张鑫旭博客读书笔记
从今天开始跟着大牛张鑫旭的步伐,每天进步一点点 问题:IE6不支持png背景透明或半透明 一.可解决的方法 补充:css滤镜主要是用来实现图像的各种特殊效果.(了解) css滤镜的标识符是“filte ...
- Android开发中的全屏背景显示方案
引子 不管是Android还是iOS平台中,都可以看到一些应用在启动的时候会先出现一个启动画面(Splash Activity),如QQ.微信等.这个启动画面中往往会将ActionBar和Status ...
- Android有趣的全透明效果--Activity及Dialog的全透明(附android系统自带图标大全)[转]
原文地址:http://blog.csdn.net/sodino/article/details/5822147 1.Activity全透明 同学zzm给了这个有趣的代码,现在公布出来. 先在res/ ...
- css3全屏背景图片切换特效
效果体验:http://hovertree.com/texiao/css3/10/ 一般做图片切换效果,都会使用JS或者jQuery脚本,今天发现,其实只用CSS也可以实现.试试效果吧. 效果图: 代 ...
- CSS之全屏背景图
吐槽啦:Yeah 明天就是国庆了o(* ̄▽ ̄*)o!哈哈,提前祝福各位园友国庆快乐.假期愉快.生活美满.天天开心!国庆我要回家一趟,把一些不用的东西带回家,走访一下亲朋好友,在家打几天酱油~~~ 言 ...
- Visual Studio 2017 设置透明背景图
一.前言 给大家分享一下,如何为VS2017设置透明背景图.下面是一张设置前和设置后的图片. 设置前: 设置后: 二.设置背景图片的扩展程序 我们打开VS的扩展安装界面:[工具]->[扩展和更新 ...
随机推荐
- POJ 3525 Most Distant Point from the Sea [半平面交 二分]
Most Distant Point from the Sea Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 5153 ...
- HoloLens开发手记-世界坐标系 Coordinate systems
坐标系 Coordinate systems 全息的核心是,全息应用可以在真实世界中放置全息图形并使得它们看起来和听起来像真实的物体.这涉及到了物体在真实世界中的定位和方向的确定,这对用户来说很重要. ...
- s5pv210 的启动
1.开发板已启动从0x0获取数据(内部64k的硬盘,里面含有三星固化的BL0段代码),将其读到a8软核中,进行运算,主要用于初始化时钟,96k的内部IRAM.并负责 指定启动设备(通常为外部硬盘),从 ...
- python学习:简单的wc命令实现
#!/usr/bin/python import sys import os try: fn = sys.argv[1] except IndexError: print &q ...
- 归并排序Merge Sort
//C语言实现 void mergeSort(int array[],int first, int last) { if (first < last)//拆分数列中元素只剩下两个的时候,不再拆分 ...
- 箱型图boxplot函数的使用
主要参数: medlwd:设置中位线宽度 whiskcol:设置虚线颜色 staplecol:设置顶端颜色 outcol:离群值颜色 相应的具体位置: outline=FALSE:去除离群值 outp ...
- 手把手教你在Ubuntu上分别安装Nginx、PHP和Mysql
手把手教你在Ubuntu上分别安装Nginx.PHP和Mysql
- Java中子类能继承父类的私有属性吗?
前段时间去听老师讲课的时候,老师告诉我子类是可以继承父类所有的属性和方法的.当时我是极其疑惑的,因为之前学校考试时这个考点我记得很清楚:子类只能继承父类的非私有属性和方法.老师给我的解释是这样的--先 ...
- gogogo
- byte[] Base64 Stream 之间相互转换
图片 base64转byte[] /// <summary> /// 保存base64图片,返回阿里云地址 /// </summary> /// <param name= ...