{"id":507,"date":"2019-07-06T12:24:58","date_gmt":"2019-07-06T03:24:58","guid":{"rendered":"http:\/\/shinke1987.net\/?p=507"},"modified":"2019-07-06T12:25:00","modified_gmt":"2019-07-06T03:25:00","slug":"post-507","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=507","title":{"rendered":"C#\u3067\u5370\u5237\u53ef\u80fd\u7bc4\u56f2\u3044\u3063\u3071\u3044\u306b\u67a0\u7dda\u3092\u66f8\u304f\u3002"},"content":{"rendered":"\n<h2 id=\"toc0\" class=\"wp-block-heading\">\u76ee\u7684<\/h2>\n\n\n\n<p>\n\u30d7\u30ea\u30f3\u30bf\u306e\u5370\u5237\u53ef\u80fd\u306a\u7bc4\u56f2\u3092\u77e5\u308b\u305f\u3081\u306b\u3001\n\u5370\u5237\u53ef\u80fd\u306a\u7bc4\u56f2\u306b\u67a0\u7dda\u3092\u66f8\u304f\u3002\n<\/p>\n<p>\nGUI\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001\u30e1\u30cb\u30e5\u30fc\u306b\n\u300c\u5370\u5237\u300d\u3068\u66f8\u304b\u308c\u305f\u9805\u76ee\u3092\u7528\u610f\u3057\u3001\n\u305d\u308c\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u5370\u5237\u53ef\u80fd\u7bc4\u56f2\u3044\u3063\u3071\u3044\u306b\u67a0\u7dda\u3092\u66f8\u304f\u4f8b\u3002\n<\/p>\n\n\n\n<h2 id=\"toc1\" class=\"wp-block-heading\">\u74b0\u5883<\/h2>\n\n\n\n<p>.NET Framework 4.7.2<\/p>\n<p>VisualStudio 2017<\/p>\n<p>Windows\u306e\u8a2d\u5b9a\u3067\u3001\u898f\u5b9a\u306e\u30d7\u30ea\u30f3\u30bf\u3092\u7269\u7406\u7684\u306a\u4f7f\u7528\u53ef\u80fd\u306a\u30d7\u30ea\u30f3\u30bf\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u308b\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        private PageSettings pageSetting = new PageSettings();\n\n        public Form1()\n        {\n            InitializeComponent();\n        }\n\n        private void \u5370\u5237ToolStripMenuItem_Click(object sender, EventArgs e)\n        {\n            try\n            {\n                \/\/ \u30de\u30fc\u30b8\u30f3\u3092\u3068\u308a\u3042\u3048\u305a\u8a2d\u5b9a\u3002\n                pageSetting.Margins = new Margins(\n                0, 0, 0, 0\n                );\n\n                \/\/ \u539f\u70b9\u3092\u8a2d\u5b9a\u3059\u308b\u3002\n                printDocument.OriginAtMargins = true;\n\n                printDocument.DefaultPageSettings = pageSetting;\n                printDialog.Document = printDocument;\n\n                printDocument.Print();\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            \/\/ \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 \u30d7\u30ea\u30f3\u30bf\u306e\u5370\u5237\u53ef\u80fd\u306a\u7bc4\u56f2\u3092\u77e5\u308b\u305f\u3081\u306b\u3001 \u5370\u5237\u53ef\u80fd\u306a\u7bc4\u56f2\u306b\u67a0\u7dda\u3092\u66f8\u304f\u3002 GUI\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001\u30e1\u30cb\u30e5\u30fc\u306b \u300c\u5370\u5237\u300d\u3068\u66f8\u304b\u308c\u305f\u9805\u76ee\u3092\u7528\u610f\u3057\u3001 \u305d\u308c\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u5370\u5237\u53ef\u80fd\u7bc4\u56f2\u3044\u3063\u3071\u3044\u306b\u67a0\u7dda\u3092\u66f8\u304f\u4f8b\u3002 \u74b0\u5883 .N [&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-507","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\/507","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=507"}],"version-history":[{"count":12,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/507\/revisions"}],"predecessor-version":[{"id":520,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/507\/revisions\/520"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}