首页 > 编程语言 >C# console application main method new and start wpf window application

C# console application main method new and start wpf window application

时间:2024-09-10 21:36:53浏览次数:13  
标签:console start win System application bmp using new

1.New Console application;

2.Add reference,PresentationCore and WindowsBase

3.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace ConsoleApp73
{
    internal class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            Window win = new Window();
            win.Title = "New WPF window from console application!";
            Image img = new Image();
            BitmapImage bmp = new BitmapImage();
            bmp.BeginInit();
            bmp.UriSource = new Uri(@"..\..\Image\1.jpg",UriKind.RelativeOrAbsolute);
            bmp.EndInit();
            bmp.Freeze();
            img.Source = bmp;
            win.Content = img;
            win.ShowDialog();
        }
    }
}

 

 

 

 

 

 

标签:console,start,win,System,application,bmp,using,new
From: https://www.cnblogs.com/Fred1987/p/18407265

相关文章

  • C# process =An error occurred trying to start process with working directory The
    usingSystem.Diagnostics;//Seehttps://aka.ms/new-console-templateformoreinformationConsole.WriteLine("Hello,World!");stringpath=@"..\..\..\Image";stringfullPath=System.IO.Path.GetFullPath(path);varimgsList=System......
  • Applications of UDTL to Intelligent Fault Diagnosis: A Survey and Comparative St
    文章目录摘要一、引言二、背景和定义A.UDTL定义B.基于UDTL的IFD分类C.基于UDTL的IFD动机D.主干结构三、LABEL-CONSISTENTUDTLA.基于网络的UDTLB.基于实例化的UDTLC.基于映射的UDTLD.基于对抗性的IFD四.LABEL-INCONSISTENTUDTLA.PartialUDTLB.OpenSetUDTLC.Uni......
  • A COMPREHENSIVE SURVEY ON EVALUATING LARGE LANGUAGE MODEL APPLICATIONS IN THE ME
    本文是LLM系列文章,针对《ACOMPREHENSIVESURVEYONEVALUATINGLARGELANGUAGEMODELAPPLICATIONSINTHEMEDICALINDUSTRY》的翻译。关于评估医疗行业中大型语言模型应用程序的综合调查摘要1引言和背景2综述的分类和结构3医学领域LLM应用评估的现状4挑战......
  • [Qt]cmake下Qt隐藏console的窗口
    最近在用Qt写一个GUI,最后release之后发现,伴随窗口启动的还有一个console窗口我用的是mingw+cmake的编译方法,查了很多资料终于找到了解决方法,如下:在CMakeList.txt中添加,然后console窗口就不见啦 #隐藏consoleif(WIN32)if(MSVC)set_target_propert......
  • 大模型API实战-console.bce.baidu.com/qianfan/
    百度千帆大模型平台API调用实战需要注册并实名制,然后到模型服务-->模型推理,选择可以免费开通的模型开通(其他都是收费的有坑)ACCESS_KEY、SECRET_KEY和AK、SK的获取ACCESS_KEY、SECRET_KEYpython调用#安装包(Python>=3.7):pipinstallqianfanimportosimportqianfan......
  • Designing Data-Intensive Applications
    《DesigningData-IntensiveApplications》是一本深入探讨数据密集型应用设计的书籍,由MartinKleppmann撰写。以下是对这本书的详细概述:书籍简介:作者信息:MartinKleppmann是一位在分布式系统领域的研究员,曾在LinkedIn和Rapportive等互联网公司工作,参与大规模数据基础设......
  • 手动添加Spring Boot的配置文件application.properties
      本文介绍在IntelliJIDEA软件中,为SpringBoot项目添加配置文件的操作方法。  最近,在IntelliJIDEA软件中新创建了一个SpringBoot项目,是通过如下图所示的方法直接新建的。  但是,随后发现这样创建的SpringBoot项目没有配置文件。如下图所示,其他的基本项目架构都是存在的......
  • Go - Web Application 10
    CreatingaunittestInGo,it’sstandardpracticetowriteyourtestsin*_test.gofileswhichlivedirectly alongsidethecodethatyou’retesting.So,inthiscase,thefirstthingthatwe’regoingtodo iscreateanewcmd/web/template_test.gofilet......
  • Design Patterns for Cloud Native Applications
    研究背景研究问题:本书旨在解决如何构建云原生应用的问题。云原生应用具有成本节约和可扩展性的优势,但其开发和部署面临诸多挑战。研究难点:云原生应用的复杂性在于如何在动态环境中设计和开发可扩展、可靠、可管理和可观测的应用。相关工作:本书参考了现有的架构原则和实......
  • Go - Web Application 9
    UsingrequestcontextAtthemomentourlogicforauthenticatingauserconsistsofsimplycheckingwhethera "authenticatedUserID"valueexistsintheirsessiondata,likeso:func(app*application)isAuthenticated(r*http.Request)bool{......