当前位置: 首页>>代码示例>>C#>>正文


C# Label.DrawToBitmap方法代码示例

本文整理汇总了C#中System.Windows.Forms.Label.DrawToBitmap方法的典型用法代码示例。如果您正苦于以下问题:C# Label.DrawToBitmap方法的具体用法?C# Label.DrawToBitmap怎么用?C# Label.DrawToBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Label的用法示例。


在下文中一共展示了Label.DrawToBitmap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: draw

        public override Bitmap draw()
        {
            bmp = new Bitmap(WIDTH,HEIGHT);
            canvas = bmp;
            clear();

            ////////////////////
            //書式データ
            ////////////////////
            //タイトル
            int titleX = CENTER - lblTitle.Width / 2;
            int titleY = 0;
            lblTitle.DrawToBitmap(bmp, new Rectangle(titleX, titleY, lblTitle.Width, lblTitle.Height));
            //今日の日付
            int dateX = (int)(WIDTH/9*6);
            int dateY = (int)(HEIGHT/11*0.6);
            lblDate.DrawToBitmap(bmp, new Rectangle(dateX, dateY, lblDate.Width, lblDate.Height));
            //受渡期日
            int deliveryDateX = (int)(0);
            int deliveryDateY = (int)(HEIGHT / 11 * 1.55);
            lblDeliveryDate.DrawToBitmap(bmp, new Rectangle(deliveryDateX, deliveryDateY, lblDeliveryDate.Width, lblDeliveryDate.Height));
            //工事名
            int constractionNameX = (int)(0);
            int constractionNameY = (int)(HEIGHT / 11 * 1.85);
            lblConstractionName.DrawToBitmap(bmp, new Rectangle(constractionNameX, constractionNameY, lblConstractionName.Width, lblConstractionName.Height));
            //支払条件
            int paymentTermsX = (int)(0);
            int paymentTermsY = (int)(HEIGHT / 11 * 2.15);
            lblPaymentTerms.DrawToBitmap(bmp, new Rectangle(paymentTermsX, paymentTermsY, lblPaymentTerms.Width, lblPaymentTerms.Height));
            //有効期限
            int expirationDateX = (int)(0);
            int expirationDateY = (int)(HEIGHT / 11 * 2.45);
            lblExpirationDate.DrawToBitmap(bmp,new Rectangle(expirationDateX, expirationDateY, lblExpirationDate.Width, lblExpirationDate.Height));
            //
            int totalFeeX = 0;
            int totalFeeY = (int)(HEIGHT / 11 * 2.75);
            lblTotalFee.DrawToBitmap(bmp,new Rectangle(totalFeeX,totalFeeY,lblTotalFee.Width,lblTotalFee.Height));
            ////////////////////

            ////////////////////
            //自社データ     7件
            ////////////////////
            //会社名
            int myCompanyNameX = (int)(WIDTH / 9 * 5.5);
            int myCompanyNameY = (int)(HEIGHT / 11 * 1.3);
            lblMyCompanyName.DrawToBitmap(bmp, new Rectangle(myCompanyNameX,myCompanyNameY , lblMyCompanyName.Width, lblMyCompanyName.Height));
            //郵便番号
            int myZipCodeX = (int)(WIDTH / 9 * 5.5);
            int myZipCodeY = (int)(HEIGHT / 11 * 1.55);
            lblMyZipCode.DrawToBitmap(bmp,new Rectangle(myZipCodeX,myZipCodeY,lblMyZipCode.Width,lblMyZipCode.Height));
            //住所
            int myAddressX = (int)(WIDTH / 9 * 5.5);
            int myAddressY = (int)(HEIGHT / 11 * 1.675);
            lblMyAddress.DrawToBitmap(bmp, new Rectangle(myAddressX,myAddressY, lblMyAddress.Width, lblMyAddress.Height));
            //代表取締役
            int myCEONameX = (int)(WIDTH / 9 * 5.5);
            int myCEONameY = (int)(HEIGHT / 11 * 1.8);
            lblMyCEOName.DrawToBitmap(bmp, new Rectangle(myCEONameX, myCEONameY, lblMyCEOName.Width, lblMyCEOName.Height));
            //電話番号
            int myTellX = (int)(WIDTH / 9 * 5.5);
            int myTellY = (int)(HEIGHT / 11 * 1.925);
            lblMyTell.DrawToBitmap(bmp, new Rectangle(myTellX, myTellY, lblMyTell.Width, lblMyTell.Height));
            //FAX
            int myFaxX = (int)(WIDTH / 9 * 7.25);
            int myFaxY = (int)(HEIGHT / 11 * 1.925);
            lblMyFax.DrawToBitmap(bmp, new Rectangle(myFaxX, myFaxY, lblMyFax.Width, lblMyFax.Height));
            //担当者
            int myChargeNameX = (int)(WIDTH / 9 * 6);
            int myChargeNameY = (int)(HEIGHT / 11 * 2.05);
            lblMyChargeName.DrawToBitmap(bmp, new Rectangle(myChargeNameX, myChargeNameY, lblMyChargeName.Width, lblMyChargeName.Height));
            ////////////////////

            /////////////////////
            //相手データ
            /////////////////////
            //会社名
            int yourCompanyNameX = 0;
            int yourCompanyNameY = (int)(HEIGHT / 11 * 1);
            lblYourCompanyName.DrawToBitmap(bmp,new Rectangle(yourCompanyNameX,yourCompanyNameY,lblYourCompanyName.Width,lblYourCompanyName.Height));
            /////////////////////

            /////////////////////
            //商品内容詳細
            /////////////////////
            dgvContent.AllowUserToAddRows = true;
            dgvContent.Rows.Clear();
            dgvContent.Rows.AddCopies(0, 24);
            int cellWidth = dgvContent.Width / 16;
            dgvContent.Columns[0].Width = cellWidth*7;
            dgvContent.Columns[1].Width = cellWidth*2;
            dgvContent.Columns[2].Width = cellWidth*1;
            dgvContent.Columns[3].Width = cellWidth*2;
            dgvContent.Columns[4].Width = cellWidth*2;
            int otherSum = 0;
            for(int i=0;i<dgvContent.Columns.Count-1;i++){
                otherSum += dgvContent.Columns[i].Width;
            }
            //dgvContent.AutoSizeRowsMode=DataGridViewAutoSizeRowsMode.AllCells;
            dgvContent.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dgvContent.Columns[5].Width = dgvContent.Width-otherSum;
//.........这里部分代码省略.........
开发者ID:Company-OOTSUBO,项目名称:project,代码行数:101,代码来源:LayoutVertical.cs

示例2: draw

        public override List<Bitmap> draw()
        {
            Bitmap bmp = new Bitmap(WIDTH, HEIGHT);
            bmps.Add(bmp);
            bmps[0] = bmp;
            //bmps.Add(bmp);
            canvas = bmp;
            clear();

            Graphics g = Graphics.FromImage(canvas);
            settingChange();

            ////////////////////
            //書式データ
            ////////////////////
            //タイトル
            int titleX = CENTER - lblTitle.Width / 2;
            int titleY = 0;
            lblTitle.DrawToBitmap(bmp, new Rectangle(titleX, titleY, lblTitle.Width, lblTitle.Height));
            //今日の日付
            int dateX = (int)(WIDTH/5*2.5);
            int dateY = (int)(HEIGHT/13*1);
            lblDate.DrawToBitmap(bmp, new Rectangle(dateX, dateY, lblDate.Width, lblDate.Height));

            //受渡期日
            int deliveryDateX = (int)(0);
            int deliveryDateY = (int)(HEIGHT / 13 * 3.5);
            lblDeliveryDate.DrawToBitmap(bmp, new Rectangle(deliveryDateX, deliveryDateY, lblDeliveryDate.Width, lblDeliveryDate.Height));
            //工事名
            int constractionNameX = (int)(WIDTH / 3);
            int constractionNameY = (int)(HEIGHT / 13 * 3.5);
            lblConstractionName.DrawToBitmap(bmp, new Rectangle(constractionNameX, constractionNameY, lblConstractionName.Width, lblConstractionName.Height));

            //支払条件
            int paymentTermsX = (int)(0);
            int paymentTermsY = (int)(HEIGHT / 13 * 4.0);
            lblPaymentTerms.DrawToBitmap(bmp, new Rectangle(paymentTermsX, paymentTermsY, lblPaymentTerms.Width, lblPaymentTerms.Height));
            //有効期限
            int expirationDateX = (int)(WIDTH / 3);
            int expirationDateY = (int)(HEIGHT / 13 * 4.0);
            lblExpirationDate.DrawToBitmap(bmp,new Rectangle(expirationDateX, expirationDateY, lblExpirationDate.Width, lblExpirationDate.Height));

            //
            int totalFeeX = 0;
            int totalFeeY = (int)(HEIGHT / 13 * 4.5);

            lblTotalFee.DrawToBitmap(bmp,new Rectangle(totalFeeX,totalFeeY,lblTotalFee.Width,lblTotalFee.Height));
            ////////////////////

            ////////////////////
            //自社データ     7件
            ////////////////////
            //会社名
            int myCompanyNameX = (int)(WIDTH / 5 * 4);
            int myCompanyNameY = (int)(HEIGHT / 13 * 2);
            lblMyCompanyName.DrawToBitmap(bmp, new Rectangle(myCompanyNameX,myCompanyNameY , lblMyCompanyName.Width, lblMyCompanyName.Height));
            //郵便番号
            int myZipCodeX = (int)(WIDTH / 5 * 4);
            int myZipCodeY = (int)(HEIGHT / 13 * 2.7);
            lblMyZipCode.DrawToBitmap(bmp,new Rectangle(myZipCodeX,myZipCodeY,lblMyZipCode.Width,lblMyZipCode.Height));
            //住所
            int myAddressX = (int)(WIDTH / 5*4);
            int myAddressY = (int)(HEIGHT / 13 * 3.2);
            lblMyAddress.DrawToBitmap(bmp, new Rectangle(myAddressX,myAddressY, lblMyAddress.Width, lblMyAddress.Height));
            //代表取締役
            int myCEONameX = (int)(WIDTH / 5 * 4);
            int myCEONameY = (int)(HEIGHT / 13 * 3.7);
            if (data.VisibleCEO)
            {
                lblMyCEOName.DrawToBitmap(bmp, new Rectangle(myCEONameX, myCEONameY, lblMyCEOName.Width, lblMyCEOName.Height));
            }
            //電話番号
            int myTellX = (int)(WIDTH / 5*4);
            int myTellY = (int)(HEIGHT / 13 * 4.2);
            lblMyTell.DrawToBitmap(bmp, new Rectangle(myTellX, myTellY, lblMyTell.Width, lblMyTell.Height));
            //FAX
            int myFaxX = (int)(WIDTH / 5*4);
            int myFaxY = (int)(HEIGHT / 13 * 4.7);
            lblMyFax.DrawToBitmap(bmp, new Rectangle(myFaxX, myFaxY, lblMyFax.Width, lblMyFax.Height));
            //担当者
            int myChargeNameX = (int)(WIDTH / 2*1);
            int myChargeNameY = (int)(HEIGHT / 13 * 4.8);
            lblMyChargeName.DrawToBitmap(bmp, new Rectangle(myChargeNameX, myChargeNameY, lblMyChargeName.Width, lblMyChargeName.Height));
            ////////////////////

            /////////////////////
            //相手データ
            /////////////////////
            //会社名
            int yourCompanyNameX = 0;
            int yourCompanyNameY = (int)(HEIGHT / 13 * 1.5);
            lblYourCompanyName.DrawToBitmap(bmp,new Rectangle(yourCompanyNameX,yourCompanyNameY,lblYourCompanyName.Width,lblYourCompanyName.Height));
            /////////////////////

            /////////////////////
            //商品内容詳細
            /////////////////////
            dgvContent.AllowUserToAddRows = true;
            dgvContent.Rows.Clear();
            dgvContent.Rows.AddCopies(0, pLimit-1);
//.........这里部分代码省略.........
开发者ID:Company-OOTSUBO,项目名称:project,代码行数:101,代码来源:LayoutHorizontal.cs


注:本文中的System.Windows.Forms.Label.DrawToBitmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。