| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1125 人关注过本帖
标题:求助:DrawString 函数
只看楼主 加入收藏
追梦人zmrghy
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:406
专家分:190
注 册:2021-4-9
结帖率:97.26%
收藏
已结贴  问题点数:20 回复次数:9 
求助:DrawString 函数
求助:DrawString 函数, 如何输出如图效果。。。。。

图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册



图片附件: 游客没有浏览图片的权限,请 登录注册


程序代码:
private: Void draw_num_str(Point^ inpoint, int wide, int num)
    {
        Image^ drawimg = gcnew Bitmap(wide, wide);
        Graphics^ g = Graphics::FromImage(drawimg);
        SolidBrush^ MyBrush = gcnew SolidBrush(Color::Cyan);
        g->FillRectangle(MyBrush, Rectangle(inpoint->X + wide / 20, inpoint->Y + wide / 20, (wide * 9) / 10, (wide * 9) / 10));
        MyBrush->Color = Color::Black;
        g->FillEllipse(MyBrush, Rectangle(inpoint->X + wide / 10, inpoint->Y + wide / 10, (wide * 4) / 5, (wide * 4) / 5));
        
        MyBrush->Color = Color::Cyan;
        
        /*-----------------------------------------------
            此处是 DrawString 绘制数字,字符串的地方
            6个 DrawString 函数,应该使用哪一个。
            实现,如图效果,代码应该如何写。。。。
        ------------------------------------------------*/
        
        this->pictureBox1->Image = drawimg;
    }
    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) 
    {
        draw_num_str(Point(0, 0), 200, 9999);
    }



DrawString 函数, 如何输出如图效果。。。。。
6个 DrawString 函数,应该使用哪一个。
实现,如图效果,代码应该如何写。。。。

[此贴子已经被作者于2022-7-22 20:45编辑过]

搜索更多相关主题的帖子: 效果 函数 代码 Color System 
2022-07-22 20:43
追梦人zmrghy
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:406
专家分:190
注 册:2021-4-9
收藏
得分:0 
为什么,都不回答我的问题呀???
2022-07-23 13:03
op123
Rank: 6Rank: 6
等 级:贵宾
威 望:21
帖 子:170
专家分:461
注 册:2022-6-4
收藏
得分:14 
我看看
2022-07-23 15:19
op123
Rank: 6Rank: 6
等 级:贵宾
威 望:21
帖 子:170
专家分:461
注 册:2022-6-4
收藏
得分:0 
你把所有代码都发出来
2022-07-23 15:22
op123
Rank: 6Rank: 6
等 级:贵宾
威 望:21
帖 子:170
专家分:461
注 册:2022-6-4
收藏
得分:0 
你这个是图形算法吧
2022-07-23 15:23
op123
Rank: 6Rank: 6
等 级:贵宾
威 望:21
帖 子:170
专家分:461
注 册:2022-6-4
收藏
得分:0 
我还有事,明天来!!!
2022-07-23 15:24
op123
Rank: 6Rank: 6
等 级:贵宾
威 望:21
帖 子:170
专家分:461
注 册:2022-6-4
收藏
得分:0 
别忘了发出来代码
2022-07-23 15:24
追梦人zmrghy
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:406
专家分:190
注 册:2021-4-9
收藏
得分:0 
回复 7楼 op123
DrawNumberString.rar (2.47 KB)


VS2022  C++/CLR  Winform.
2022-07-23 17:35
op123
Rank: 6Rank: 6
等 级:贵宾
威 望:21
帖 子:170
专家分:461
注 册:2022-6-4
收藏
得分:0 
麻烦打出来代码,我家旧电脑打开不方便,我家电脑版本低
2022-07-24 18:44
追梦人zmrghy
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:406
专家分:190
注 册:2021-4-9
收藏
得分:0 
回复 9楼 op123
程序代码:
#pragma once

namespace DrawNumberString {

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    /// <summary>
    /// Form1 摘要
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            //TODO:  在此处添加构造函数代码
            //
        }

    protected:
        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::PictureBox^ pictureBox1;
    private: System::Windows::Forms::Button^ button1;
    protected:

    private:
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        void InitializeComponent(void)
        {
            this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
            this->button1 = (gcnew System::Windows::Forms::Button());
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->BeginInit();
            this->SuspendLayout();
            // 
            // pictureBox1
            // 
            this->pictureBox1->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(255)), static_cast<System::Int32>(static_cast<System::Byte>(224)),
                static_cast<System::Int32>(static_cast<System::Byte>(192)));
            this->pictureBox1->Location = System::Drawing::Point(0, 0);
            this->pictureBox1->Name = L"pictureBox1";
            this->pictureBox1->Size = System::Drawing::Size(200, 200);
            this->pictureBox1->TabIndex = 0;
            this->pictureBox1->TabStop = false;
            // 
            // button1
            // 
            this->button1->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(255)), static_cast<System::Int32>(static_cast<System::Byte>(128)),
                static_cast<System::Int32>(static_cast<System::Byte>(0)));
            this->button1->Font = (gcnew System::Drawing::Font(L"宋体", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
                static_cast<System::Byte>(134)));
            this->button1->ForeColor = System::Drawing::Color::Blue;
            this->button1->Location = System::Drawing::Point(48, 203);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(104, 39);
            this->button1->TabIndex = 1;
            this->button1->Text = L"D R A W";
            this->button1->UseVisualStyleBackColor = false;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(200, 246);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->pictureBox1);
            this->Name = L"Form1";
            this->Text = L"Form1";
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->pictureBox1))->EndInit();
            this->ResumeLayout(false);

        }
#pragma endregion
    private: Void draw_num_str(Point^ inpoint, int wide, int num)
    {
        Image^ drawimg = gcnew Bitmap(wide, wide);
        Graphics^ g = Graphics::FromImage(drawimg);
        SolidBrush^ MyBrush = gcnew SolidBrush(Color::Cyan);
        g->FillRectangle(MyBrush, Rectangle(inpoint->X + wide / 20, inpoint->Y + wide / 20, (wide * 9) / 10, (wide * 9) / 10));
        MyBrush->Color = Color::Black;
        g->FillEllipse(MyBrush, Rectangle(inpoint->X + wide / 10, inpoint->Y + wide / 10, (wide * 4) / 5, (wide * 4) / 5));
        
        MyBrush->Color = Color::Cyan;
        
        /*-----------------------------------------------
            此处是 DrawString 绘制数字,字符串的地方
            6个 DrawString 函数,应该使用哪一个。
            实现,如图效果,代码应该如何写。。。。
        ------------------------------------------------*/

        this->pictureBox1->Image = drawimg;
    }
    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) 
    {
        draw_num_str(Point(0, 0), 200, 9999);
    }
    };
}
2022-07-25 00:58
快速回复:求助:DrawString 函数
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039998 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved