如何从richtextbox获取像素颜色

如何从richtextbox获取像素颜色

本文介绍了如何从richtextbox获取像素颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

on richTextBox(bachground color black and white forground)我写了一封来自richTextBox的字母y

我希望得到矩形尺寸为64X64像素的颜色。

问题,因为你可能会讨论我无法从richTextBox获取位图

见A行



我尝试过:



on richTextBox(bachground color black and white forground) i wrote letter y
from the richTextBox i want to get the color of the rectangle size 64X64 pixels.
the problem as you may gussed i could not get a bitmap from the richTextBox
see line A

What I have tried:

Color[,] pixelColor = new Color[100, 100];
//objMyBitMap = new Bitmap(640, //480,System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            Bitmap rtb = (Bitmap)richTextBox1.Clone();//<-------  Line A
            for (i = 1; i < 64+1; i++)
            {
                for (j = 1; j < 64+1; j++)
                {
                    //pixelColor[i,j] = objMyBitMap.GetPixel(i, j);
                    pixelColor[i,j] = rtb.GetPixel(i, j);
                }
            }

推荐答案


这篇关于如何从richtextbox获取像素颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 00:29