About Window or About Box in WPF 3.5 (VS2008)

谁都会走 提交于 2019-12-11 01:15:02

问题


I am looking for About Window for WPF VS2008. Any Source code is available to download or one have to develop on his/her own.

Thanks you, Harsha


回答1:


You might try this WPF About Box (CS). If you wish to dynamically get the version author etc. from Assembly, try this blog.




回答2:


Just create a normal WPF Window and make it look like an about box (add text blocks for product name, version, copyright ...)

There is nothing special about the WinForms about box, it's just a normal form preloaded with common about box controls, there is no reason to use it from WPF.




回答3:


Microsoft have delivered a gee-whiz WPF AboutBox for VS2010 (as a downloadable control, not in the product) but there was no such beast in VS2008 last time I looked (about a month ago).

I ended up just creating a WinForms one (from the wizard) which worked fine. I then found I could simplify it to just use hard-coded values since I didn't need any of that variable-based stuff:

AboutBox1.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

namespace Dodgy {
    partial class AboutBox1 : Form {
        public AboutBox1() {
            InitializeComponent();
            this.Text = "About Dodgy Thing";
            this.labelProductName.Text = "Dodgy Thing";
            this.labelVersion.Text = "Version 1.0";
            this.labelCopyright.Text = "Copyright 2010. All rights reserved.";
            this.labelCompanyName.Text = "Dodgy Brothers Software GmbH";
            this.textBoxDescription.Text
                = "Dodgy Thing allows you to do all sorts of dodgy things.";
        }
    }
}

To call it, just use:

AboutBox1 about = new AboutBox1();
about.ShowDialog();

I haven't included the boilerplate files from the wizard, AboutBox1.Designer.cs and AboutBox1.resx, since the attempt made me realise SO has a 30K limit for answers (and they're pretty chunky). You should just use what the wizard gives you.



来源:https://stackoverflow.com/questions/3411952/about-window-or-about-box-in-wpf-3-5-vs2008

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!