Ⅰ 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一樣.