PDA

View Full Version : Immagini da stampare Dot.net


mangzeus
22-03-2004, 12:34
Volevo sapere se esisteva un metodo per quando si deve richiamare un immagine da stampare il quale mi possa far modificare la dimensione dell'immagine stessa...

esempio: il metodo drawimage mi restituisce l'immagine con le dimensioni originali (oppure modificarle in formato di stampa, cioè anche se mi si visualizza in grande l'immagine sul form l'importante è che poi sulla stampa esca con le dimensioni che voglio io) volevo sapere se ne esisteva uno dove è possibile modificarle...o se non esiste come faccio a modificare le dimensioni dell'immagine da codice??è possibile??

grazie

Mazza2
22-03-2004, 12:48
public Bitmap(Image original,Size newSize);


Parameters:

original: The Image object from which to create the new Bitmap object.

newSize: The Size structure that represent the size of the new Bitmap.

Mazza2
22-03-2004, 12:51
[C#]
public Bitmap(Image original, Size newSize);

[C++]
public: Bitmap(Image* original, Size newSize);

[JScript]
public function Bitmap(original : Image, newSize : Size);





scusa dimenticavo che nn esiste solo c# :sofico:

mangzeus
22-03-2004, 13:23
Originariamente inviato da Mazza2
public Bitmap(Image original,Size newSize);


Parameters:

original: The Image object from which to create the new Bitmap object.

newSize: The Size structure that represent the size of the new Bitmap.


è una funzione che esiste già o me la devo creare io...??cioè come faccio a farmi ritornare l'immagine modificata??devo metterla dentro un avariabile...scusami ma sono agli inizi e sono ignorante in materia...ne approfitto per farti anche un altra domanda...Non ho trovato un metodo del datareader che si posizioni alla fine o all'inizio dei record del database, non so se hai presente in vb6 che c'erano .eof e .bof per la fine e l'inizio dei record...

Mazza2
22-03-2004, 14:21
Dunque: Bitmap e' una classe concreta che estende la classe Image che e' astratta. Devi importare il namespace System.Drawing.Bitmap per poterla usare. per stamparla poi fai come hai fatto finora...




per il datareader, nn sono pratico , ma cosi' a naso dando un occhio alla documentazione, se vuoi leggere da un database usa le classi e i metodi che trovi nel namespace: System.Data.SqlClient


un piccolo stralcio dalla documentazione:


using System;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;


//This C# example uses the DataReader to read some of the columns from the Northwind Orders table.
//SqlTypes are used to retrieve the values.

public class DataReaderSample
{
public static void Main()
{
// Use the default SQL Server on this machine.
// Change the values in myConnectionString for user id
// and password.
string myConnectionString =
"server=(local);Persist Security Info=False;Integrated Security=SSPI;initial catalog=northwind";

// Query string to get some records from Orders table
string myQuery = "SELECT OrderID, CustomerID, " +
"OrderDate, Freight, ShipName FROM Orders";

// First column OrderID is int datatype in SQL Server
// and maps to SQLInt32
SqlInt32 oOrderID;

// Second column CustomerID is nchar in SQL Server
// and maps to SQLString
SqlString oCustomerID;

// Third column OrderDate is datetime in SQL Server
// and maps to SQLDateTime
SqlDateTime oOrderDate;

// Fourth column Freight is money in SQL Server and
// maps to SQLMoney
SqlMoney oFreight;

// Fifth column ShipName is nvarchar in SQL Server
// and maps to SQLString
SqlString oShipName;


//Date to compare against order date.
SqlDateTime oMergerDate = new SqlDateTime(1997,11,1);
string sDivision;

//Connect and do the query
SqlConnection myConnection = new SqlConnection(myConnString);
SqlCommand myCommand = new SqlCommand(myQuery,myConnection);
myConnection.Open();
SqlDataReader myDataReader;
myDataReader = myCommand.ExecuteReader();

// Read the rows from the query result.
while (myDataReader.Read())
{
//Get the columns in the row as SqlTypes
oOrderID = myDataReader.GetSqlInt32(0);
oCustomerID = myDataReader.GetSqlString(1);
oOrderDate = myDataReader.GetSqlDateTime(2);
oFreight = myDataReader.GetSqlMoney(3);
oShipName = myDataReader.GetSqlString(4);

//Do something with the data...we just do one
//comparison and print the values.

//Compare the OrderDate with oMergerDate
if (oMergerDate > oOrderDate)
sDivision = "A";
else
sDivision = "B";

Console.Write(sDivision + ", ");
Console.Write(oOrderID + ", ");
Console.Write(oCustomerID + ", ");
Console.Write(oOrderDate + ", ");
Console.Write(oFreight + ", ");
Console.Write(oShipName);
Console.WriteLine();
}

// Always call Close when done reading.
myDataReader.Close();

// Close the connection when done with it.
myConnection.Close();
}

}



se hai dimestichezza con l'interfacciamento ad un database non dovrebbe essere difficile capire come funziona leggendo queste righe di codice...


ma tu hai la documentazione??

mangzeus
22-03-2004, 15:30
documentazione che c'è all'interno di dot.net si...ma io nn uso c++ uso vb.net...e sono alla ricerca di questo metodo o proprietà che ritorna la fine e l'inizio del database...

mangzeus
24-03-2004, 09:11
up