using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; using System.Drawing.Printing; using System.Runtime.InteropServices; using System.Drawing; namespace Demo { public class SettingConfigur…
Private Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As LongFunction…
By default, Swing uses a cross-platform look and feel called Metal. In most cases, it is more desirable to use a look and feel that is closer to the platform on which the application is being run. This example demonstrates how to retrieve and install…
实现这个功能需要使用windows api [DllImport("winspool.drv")] public static extern bool SetDefaultPrinter(String Name); //调用win api将指定名称的打印机设置为默认打印机 private static PrintDocument PrintDocument = new PrintDocument(); public static void SetDefaultPrint(string…
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Med…
本文主要介绍如何获取以及设置系统的默认打印机. 1.获取系统中的所有打印机 获取系统中的所有打印机可以使用EnumPrinters()函数,该函数可以枚举全部的本地.网络打印机信息.其函数原型为: BOOL WINAPI EnumPrinters( DWORD Flags, LPSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned ); 其中,参数Flags可以…
>_< 为了获取文件属性,用户可以使用GetFileAttributes与GetFileAttributesEx函数. GetFileAttributesEx函数除了返回文件属性外,还返回文件时间信息.文件大小等.GetFileAttributesEx将返回结果保存在WIN32_FILE_ATTRIBUTE DATA结构中.>_< 获取的文件时间是以FILETIME格式存在的,如果要正确显示,还需要对其时区进行调整,调整为本地时区,然后转换为系统时间格式,便于显示.>_<…
实现如下效果: 实现方式如下: using System;using System.Drawing.Printing;using System.Runtime.InteropServices;using System.Windows.Forms; namespace PISS.View.CustomControl{ public partial class PrinterConfigMessBox : Form { #region 定义.构造.初始化 [DllImport("winspool.d…
项目中,需要选择打印机,切换打印机.demo如下(wpf应用程序): Xaml: <Window x:Class="PrintersApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWin…
使用CookieHelper帮助类: public class CookieHelper { #region 获取Cookie /// <summary> /// 获得Cookie的值 /// </summary> /// <param name="cookieName"></param> /// <returns></returns> public static string GetCookieValue(str…