?? show.~cpp
字號:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "show.h"
#include "SetLineStyle.h"
#include "SetBrushStyle.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormPaint(TObject *Sender)
{
GISRECT gisRect;
gisRect.x1 =m_GisVector.m_gisFileHeader.giMinX ;
gisRect.x2 =m_GisVector.m_gisFileHeader.giMaxX ;
gisRect.y1 =m_GisVector.m_gisFileHeader.giMinY ;
gisRect.y2 =m_GisVector.m_gisFileHeader.giMaxY ;
TRect dest(0,0,Width,Height);
m_GisVector.Draw (Canvas,gisRect,dest);
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormResize(TObject *Sender)
{
Invalidate();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
Action=caFree;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::BitmapSymClick(TObject *Sender)
{
if(m_GisVector.m_gisFileHeader.giType != GIS_POLYGON)
return;
if(OpenDialog1->Execute())
{
m_GisVector.SetBitmapBrush (OpenDialog1->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
int oldSelectID = m_GisVector.m_nSelectID;
m_GisVector.SelectPolygon(TPoint(X,Y));
if(m_GisVector.m_nSelectID < 0) //如果點不在任何多邊形之中,則直接退出
return;
LPGISPOLYGON polygon = (GISPOLYGON*)(m_GisVector.m_lpPolygonList->Items[m_GisVector.m_nSelectID]);
TRect invalRect2 = m_GisVector.GisRectToTRect(polygon->outRect);
//更新現選擇的多邊形
InvalidateRect(Handle,&invalRect2, true);
if(oldSelectID >= 0)
{
//更新原選擇多邊形
polygon = (GISPOLYGON*)(m_GisVector.m_lpPolygonList->Items[oldSelectID]);
TRect invalRect1 = m_GisVector.GisRectToTRect(polygon->outRect);
InvalidateRect(Handle,&invalRect1, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::LineStyleClick(TObject *Sender)
{
if(m_GisVector.m_nSelectID <= 0)
return;
LPGISPOLYGON polygon = (GISPOLYGON*)(m_GisVector.m_lpPolygonList->Items[m_GisVector.m_nSelectID]);
TLineStyleDlg *LineStyleDlg = new TLineStyleDlg(this);
LineStyleDlg->Image->Canvas->Pen->Style = polygon->pPen->Style;
LineStyleDlg->ShowModal ();
if(LineStyleDlg->ModalResult == mrOk)
{
polygon->pPen->Style = LineStyleDlg->Image->Canvas->Pen->Style;
polygon->pPen->Width = LineStyleDlg->Image->Canvas->Pen->Width;
polygon->pPen->Color = LineStyleDlg->Image->Canvas->Pen->Color;
}
Invalidate();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FillStyleClick(TObject *Sender)
{
if(m_GisVector.m_nSelectID <= 0)
return;
LPGISPOLYGON polygon = (GISPOLYGON*)(m_GisVector.m_lpPolygonList->Items[m_GisVector.m_nSelectID]);
TBrushStyleDlg *PolygonStyDlg = NULL;
PolygonStyDlg = new TBrushStyleDlg(this);
PolygonStyDlg->Image->Canvas->Brush->Style = polygon->pBrush->Style ;
PolygonStyDlg->Image->Canvas->Brush->Color = polygon->pBrush->Color;
PolygonStyDlg->ShowModal();
if(PolygonStyDlg->ModalResult == mrOk)
{
polygon->pBrush->Style = PolygonStyDlg->Image->Canvas->Brush->Style;
polygon->pBrush->Color = PolygonStyDlg->Image->Canvas->Brush->Color;
}
Invalidate();
}
//---------------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -