unit1.cpp
来自「彩色图片转16进制格式软件源码」· C++ 代码 · 共 52 行
CPP
52 行
//---------------------------------------------------------------------------
#include <stdio.h>
//#include <wingdi.h>
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int temp1;
temp1=Image1->Width;
Edit1->Text ="图像宽度="+IntToStr(temp1);
temp1=Image1->Height;
Edit2->Text ="图像高度="+IntToStr(temp1);
//temp1=Image1->Canvas->Pixels;
Canvas->Brush->Color=RGB(255,0,0);
Canvas->Brush->Style=bsSolid;
Canvas->Rectangle(5,5,50,50);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
unsigned long temp1;
temp1=Image1->Canvas->Pixels[X][Y];
//temp1=GetGValue(color);
Edit3->Text ="颜色值="+IntToStr(temp1);
Edit4->Text="X坐标值="+IntToStr(X);
Edit5->Text="Y坐标值="+IntToStr(Y);
Edit6->Text ="红色值="+IntToStr(GetRValue(temp1));
Edit7->Text ="绿色值="+IntToStr(GetGValue(temp1));
Edit8->Text ="蓝色值="+IntToStr(GetBValue(temp1));
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?