Ⅰ WPF,如何制作软件的启动窗体
自己实现了,SplashScreen本身只支持图片,做个窗口,内部用BackgroundWork组件DoWork事件里初始化你的工作,在compleded事件里弹出你要的主窗口。
Ⅱ WPF中用xaml怎么给Gird或canvas插入背景图片
下面我就大概说下过程,首页建立一个工程为WpfLoginView,并在Expression Blend 下设置一个如下图的界面
publicLoginView()
{
this.InitializeComponent();
txtusername.Focus();//聚焦在用户名输入框中
//在此点之下插入创建对象所需的代码。
ImageBrushb=newImageBrush();
b.ImageSource=newBitmapImage(newUri("pack://application:,,,/Login.png"));
b.Stretch=Stretch.Fill;
this.Background=b;
}
直接在构造函数中输入以上代码就Ok了。
Ⅲ c# 通过开机启动项添加开机启动
步骤:
1,首先创建应用程序的快捷方式。找到自己想加入开机启动项的应用程序,本文以iexplore为例在iexplore应用程序点击右键->发送到->桌面快捷方式
(也可以直接用鼠标拖动到桌面)
2,然后在桌面上就有了想加入开机启动项的应用程序快捷方式,到第6步时使用,
3,打开文件资源管理器,进入c:\盘,
4,如果没有显示隐藏的文件夹,则把“显示隐藏文件夹”选项打开在资源管理器中点击“查看”->"隐藏的项目",打上钩。此时ProgrameData文件夹就会显示出来了
5,进入目录C: \ProgramData\ Microsoft \Windows\【开始】菜单 \ 程序 \StartUp。
6,把第2步应用程序快捷方式剪切(或者复制)并粘贴到C: \ProgramData\ Microsoft \Windows\【开始】菜单 \ 程序 \StartUp目录中。
7,应用程序快捷方式加入到了启动项,下次重启电脑之后这个应用程序就会自动开机运行。
Ⅳ wpf后台点击按钮打开图片
图片我已经放在resources下面了---怎么放的?正确步骤是项目-右键-添加现有项,选择图片,而且把属性改成Resource。
Ⅳ wpf 怎么为label 添加 图标
直接定义在控件中,如下:
<LabelWidth="200"Height="100">
<Label.Content>
<DockPanel>
<ImageSource="logo.png"Width="20"Height="20"DockPanel.Dock="Left"/>
<TextBlockText="33333333333"DockPanel.Dock="Right"/>
</DockPanel>
</Label.Content>
</Label>
在样式中定义如下:
<Style x:Key="LabelStyle1" TargetType="{x:Type Label}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Label}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<DockPanel>
<Image Source="logo.png" Width="20" Height="20" DockPanel.Dock="Left"/>
<ContentPresenter DockPanel.Dock="Right" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Ⅵ wpf 添加动态图片
WPF很强大,但是当WPF的image控件遇到gif时就只读了图片的第一帧,很好很强大!
WPF不屑于gif的简单动画!
但是这对程序员来说不大爽啊!急得我眼泪都下来了!
幸好WPF里有MediaElement这个东西,它是对MediaPlyer的一个封装,果然很强大啊。不过另我不爽的是我这里有N个gif图片就要有N个MediaElement,要了亲命了。
还是不好,如果你能想到用WebBrowseControl来实现,或者用Frame来实现,恭喜你,你太有才了!
我还是不想这么去做,才分不够啊!
重写一下WPF的image,good idea!
public class GIFImageControl : System.Windows.Controls.Image
{
delegate void OnFrameChangedDelegate();
private Bitmap m_Bitmap;
public string Path { get; set; }
BitmapSource bitmapSource;
public void AnimatedImageControl(string path)
{
Path = path;
m_Bitmap = (Bitmap)Image.FromFile(path);
Width = m_Bitmap.Width;
Height = m_Bitmap.Height;
ImageAnimator.Animate(m_Bitmap, OnFrameChanged);
bitmapSource = GetBitmapSource();
Source = bitmapSource;
}
private void OnFrameChanged(object sender, EventArgs e)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal,
new OnFrameChangedDelegate(OnFrameChangedInMainThread));
}
private void OnFrameChangedInMainThread()
{
ImageAnimator.UpdateFrames();
if (bitmapSource != null)
bitmapSource.Freeze();
bitmapSource = GetBitmapSource();
Source = bitmapSource;
InvalidateVisual();
}
//private static bool loaded;
private BitmapSource GetBitmapSource()
{
IntPtr inptr = m_Bitmap.GetHbitmap();
bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
inptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
DeleteObject(inptr);
return bitmapSource;
}
[DllImport("gdi32")]
static extern int DeleteObject(IntPtr o);
}
ok,用window原有的东西去绑定到wpf上去。很好吧!是不是也比较有才呢?
来自: http://hi..com/mych/blog/item/1eb14f545f12a752564e00be.html
Ⅶ 如何给wpf的按钮添加背景图片
1、首先你得打开你的VS2015,没有VS2015的下载安装一个,下载安装方法见一下经验。打开你的VS2015,创建一个WPF窗体程序。
Ⅷ WPF 绘制如 PS的启动画面
1、不使用SplashScreen方式,无非就是自定义一个启动窗体,外观设置为None,使用你需要的图片做为背景,添加需要的文字等等;
2、修改App.xaml文件,在构造主窗体前加载启动窗体来达到先显示启动窗体的目的,使用延时或是点击事件来关闭它并显示主窗体;
3、至于程序的当前状态,可以直接在构造启动窗体时传递相关的数据并显示,也可以单独开一个线程来处理数据,并使用委托更新其显示。
基本就是这样,希望对你有帮助,有疑问请追问或是Hi
Ⅸ wpf应用程序设置窗体背景图片
直接右键添加啊,然后在格式那一栏里面设置为所以格式将图片添加进来,最后在代码去写上Image source=“sds111.jpg”就OK啦,我这里是假设图片的号码是sds111.jpg
Ⅹ 关于WPF设置程序开机启动的问题,急啊~~~
current user的run下的程序是登录自启动的, 其启动由run.exe负责.
你的程序的启动时间不归你管, 除非你能修改系统, 不然是无法延时的.
如果你是想晚点执行某个功能的话, 在你自己的程序中使用定时器好了. 程序内部的运行是可控的, 外部别人包括系统怎么操作, 只能顺着别人的意思, 是不可控的. 如同你不能控制用户什么时候双击exe一样.