git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1058 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
48
ShpViewer/ShpViewForm.cs
Normal file
48
ShpViewer/ShpViewForm.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ImageDecode;
|
||||
using System.IO;
|
||||
|
||||
namespace ShpViewer
|
||||
{
|
||||
public partial class ShpViewForm : Form
|
||||
{
|
||||
ShpReader shpReader;
|
||||
List<Bitmap> bitmaps = new List<Bitmap>();
|
||||
|
||||
public ShpViewForm( string filename )
|
||||
{
|
||||
shpReader = new ShpReader( File.OpenRead( filename ) );
|
||||
|
||||
foreach( ImageHeader h in shpReader )
|
||||
{
|
||||
byte[] imageBytes = h.Image;
|
||||
|
||||
Bitmap bitmap = new System.Drawing.Bitmap( shpReader.Width, shpReader.Height );
|
||||
for( int x = 0 ; x < shpReader.Width ; x++ )
|
||||
for( int y = 0 ; y < shpReader.Height ; y++ )
|
||||
bitmap.SetPixel( x, y, Color.FromArgb( imageBytes[ x + shpReader.Width * y ], 0, 0 ) );
|
||||
bitmaps.Add( bitmap );
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnPaint( PaintEventArgs e )
|
||||
{
|
||||
base.OnPaint( e );
|
||||
|
||||
int y = 10;
|
||||
foreach( Bitmap b in bitmaps )
|
||||
{
|
||||
e.Graphics.DrawImage( b, 10, y );
|
||||
y += 10 + b.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user