{"id":521,"date":"2019-07-06T14:09:59","date_gmt":"2019-07-06T05:09:59","guid":{"rendered":"http:\/\/shinke1987.net\/?p=521"},"modified":"2019-07-06T14:10:01","modified_gmt":"2019-07-06T05:10:01","slug":"post-521","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=521","title":{"rendered":"C#\u3067\u5370\u5237\u53ef\u80fd\u7bc4\u56f2\u3044\u3063\u3071\u3044\u306b\u67a0\u7dda\u3092\u66f8\u304f\uff08\u30d7\u30ea\u30f3\u30bf\u3092\u9078\u629e\u53ef\u80fd\uff09"},"content":{"rendered":"\n<h2 id=\"toc0\" class=\"wp-block-heading\">\u76ee\u7684<\/h2>\n\n\n\n<p>\u524d\u56de\u306e<a rel=\"noreferrer noopener\" aria-label=\"C#\u3067\u5370\u5237\u53ef\u80fd\u7bc4\u56f2\u3044\u3063\u3071\u3044\u306b\u67a0\u7dda\u3092\u66f8\u304f (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\" href=\"https:\/\/shinke1987.net\/?p=507\" target=\"_blank\">C#\u3067\u5370\u5237\u53ef\u80fd\u7bc4\u56f2\u3044\u3063\u3071\u3044\u306b\u67a0\u7dda\u3092\u66f8\u304f<\/a>\u306b\u30d7\u30ea\u30f3\u30bf\u3092\u9078\u629e\u3057\u3066\u3082\u540c\u3058\u3088\u3046\u306b\u52d5\u4f5c\u3059\u308b\u3088\u3046\u306b\u5c11\u3057\u5909\u66f4\u3057\u305f\u3082\u306e\u3002<\/p>\n\n\n\n<h2 id=\"toc1\" class=\"wp-block-heading\">\u74b0\u5883<\/h2>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\"\u524d\u56de (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\" href=\"https:\/\/shinke1987.net\/?p=507\" target=\"_blank\">\u524d\u56de<\/a>\u3068\u540c\u3058\u3002<\/p>\n\n\n\n<h2 id=\"toc2\" class=\"wp-block-heading\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows.Forms;\nusing System.Drawing.Printing;\nusing System.Drawing;\n\nnamespace _20190608_PrintTest\n{\n    public partial class Form1 : Form\n    {\n        public Form1()\n        {\n            InitializeComponent();\n        }\n\n        private void \u5370\u5237ToolStripMenuItem_Click(object sender, EventArgs e)\n        {\n            try\n            {\n                MessageBox.Show(\n                    &quot;Printer Name : &quot; + printDocument.PrinterSettings.PrinterName,\n                    &quot;Printer Name&quot;);\n\n                \/\/ \u539f\u70b9\u3092\u8a2d\u5b9a\u3059\u308b\u3002\n                printDocument.OriginAtMargins = true;\n\n                \n                printDialog.Document = printDocument;\n\n                if (printDialog.ShowDialog() == DialogResult.OK)\n                {\n                    printDocument.DefaultPageSettings = new PageSettings(printDocument.PrinterSettings);\n                    printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);\n                    MessageBox.Show(\n                        &quot;Printer Name : &quot; + printDocument.PrinterSettings.PrinterName,\n                        &quot;Printer Name&quot;);\n\n                    printDocument.Print();\n                }\n                else\n                {\n                    return;\n                }\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show(ex.Message, &quot;\u30a8\u30e9\u30fc&quot;);\n            }\n\n        }\n\n        private void printDocument_PrintPage(object sender, PrintPageEventArgs e)\n        {\n\n            MessageBox.Show(\n                &quot;X : &quot; + e.PageSettings.PrintableArea.X.ToString() + &quot;\\n&quot;\n                + &quot;Y : &quot; + e.PageSettings.PrintableArea.Y.ToString() + &quot;\\n&quot;\n                + &quot;Width : &quot; + e.PageSettings.PrintableArea.Width.ToString() + &quot;\\n&quot;\n                + &quot;Height : &quot; + e.PageSettings.PrintableArea.Height.ToString(),\n                &quot;PrintableArea&quot;\n                );\n\n\n            \/\/ \u5370\u5237\u53ef\u80fd\u306a\u9818\u57df\u3092\u67a0\u3067\u56f2\u3080\u3002\n            e.Graphics.DrawRectangle(\n                new Pen(Color.Blue, 2),\n                e.PageSettings.PrintableArea.X,\n                e.PageSettings.PrintableArea.Y,\n                e.PageSettings.PrintableArea.Width,\n                e.PageSettings.PrintableArea.Height\n                );\n        }\n    }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u7684 \u524d\u56de\u306eC#\u3067\u5370\u5237\u53ef\u80fd\u7bc4\u56f2\u3044\u3063\u3071\u3044\u306b\u67a0\u7dda\u3092\u66f8\u304f\u306b\u30d7\u30ea\u30f3\u30bf\u3092\u9078\u629e\u3057\u3066\u3082\u540c\u3058\u3088\u3046\u306b\u52d5\u4f5c\u3059\u308b\u3088\u3046\u306b\u5c11\u3057\u5909\u66f4\u3057\u305f\u3082\u306e\u3002 \u74b0\u5883 \u524d\u56de\u3068\u540c\u3058\u3002 \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9 using System; using System.Collecti [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[36],"class_list":["post-521","post","type-post","status-publish","format-standard","hentry","category-c-sharp","tag-c-sharp"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=521"}],"version-history":[{"count":4,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/521\/revisions"}],"predecessor-version":[{"id":525,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/521\/revisions\/525"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}