Click here to Skip to main content
16,005,141 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionCreate .CAB file using Winzip Pin
~Khatri Mitesh~1-Nov-08 4:45
~Khatri Mitesh~1-Nov-08 4:45 
AnswerRe: Create .CAB file using Winzip Pin
Dave Kreskowiak1-Nov-08 14:17
mveDave Kreskowiak1-Nov-08 14:17 
AnswerRe: Create .CAB file using Winzip Pin
Thomas Stockwell3-Nov-08 1:50
professionalThomas Stockwell3-Nov-08 1:50 
AnswerRe: Create .CAB file using Winzip Pin
Jon_Boy3-Nov-08 2:45
Jon_Boy3-Nov-08 2:45 
GeneralRe: Create .CAB file using Winzip Pin
~Khatri Mitesh~5-Nov-08 23:11
~Khatri Mitesh~5-Nov-08 23:11 
QuestionHow to change pixel size for an image Pin
Vineet Swami1-Nov-08 3:20
Vineet Swami1-Nov-08 3:20 
AnswerRe: How to change pixel size for an image Pin
Guffa1-Nov-08 6:11
Guffa1-Nov-08 6:11 
GeneralRe: How to change pixel size for an image [modified] Pin
Luc Pattyn1-Nov-08 6:35
sitebuilderLuc Pattyn1-Nov-08 6:35 
Hi,

none of the code you have shown belongs in the Paint handler of a PictureBox,
because 1) a PictureBox does its own painting anyhow, and 2) the code
shown should not execute every time the PB needs being repainted.

There are two ways to do what you want, depending on the details of what
you want:

1.
simply scaling up an image is something a PictureBox does naturally.
Just make the PB twice as large as the image is, and set its
SizeMode to PictureBoxSizeMode.StretchImage
This can be handled in the Visual Designer, without adding your own code.
Doing so the PB will use interpolation to calculate the new pixels,
which is fine for displaying pictures etc.

2.
if you want to replicate the existing pixels (e.g. because you want to
create a pixel editor), without calculating new pixels, it is a bit more
complex. There are again two ways:

2a.
calculate a new image yourself, twice as large; use two nested loops,
and the Image.GetPixel() and SetPixel() methods, unless performance is
very important (then use unsafe code and pointers)
Do this in a method that runs only once, e.g. the Form's Load handler.

2b.
Use a Panel instead of a PictureBox, provide your own Paint handler that
sets Graphics.InterpolationMode to InterpolationMode.NearestNeighbor
and draws the image yourself with Graphics.DrawImage.
If the borders need to be accurate too, you need a more elaborate DrawImage
overload that allows you to apply a translation over half a pixel in both
dimensions.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Fixturized forever. Confused | :confused:


modified on Saturday, November 1, 2008 1:16 PM

QuestionTransfer data from one database to another Pin
pank@12341-Nov-08 3:07
pank@12341-Nov-08 3:07 
AnswerRe: Transfer data from one database to another Pin
Dave Kreskowiak1-Nov-08 5:12
mveDave Kreskowiak1-Nov-08 5:12 
GeneralRe: Transfer data from one database to another Pin
pank@12342-Nov-08 17:43
pank@12342-Nov-08 17:43 
GeneralRe: Transfer data from one database to another Pin
Dave Kreskowiak3-Nov-08 1:39
mveDave Kreskowiak3-Nov-08 1:39 
GeneralRe: Transfer data from one database to another Pin
pank@12343-Nov-08 2:05
pank@12343-Nov-08 2:05 
GeneralRe: Transfer data from one database to another Pin
Jon_Boy3-Nov-08 2:43
Jon_Boy3-Nov-08 2:43 
GeneralRe: Transfer data from one database to another Pin
Dave Kreskowiak3-Nov-08 3:26
mveDave Kreskowiak3-Nov-08 3:26 
GeneralRe: Transfer data from one database to another Pin
Jon_Boy3-Nov-08 5:16
Jon_Boy3-Nov-08 5:16 
Questionconverting vb.net Windows Application to Web Application Pin
vijaylumar31-Oct-08 23:14
vijaylumar31-Oct-08 23:14 
AnswerRe: converting vb.net Windows Application to Web Application Pin
Colin Angus Mackay31-Oct-08 23:25
Colin Angus Mackay31-Oct-08 23:25 
AnswerRe: converting vb.net Windows Application to Web Application Pin
Sathesh Sakthivel1-Nov-08 2:17
Sathesh Sakthivel1-Nov-08 2:17 
AnswerRe: converting vb.net Windows Application to Web Application Pin
rprateek4-Nov-08 15:51
rprateek4-Nov-08 15:51 
QuestionOWC11, context menu Pin
valkyriexp31-Oct-08 11:26
valkyriexp31-Oct-08 11:26 
QuestionBLUETOOTH VB.NET Pin
ste199031-Oct-08 10:09
ste199031-Oct-08 10:09 
AnswerRe: BLUETOOTH VB.NET Pin
Johan Hakkesteegt31-Oct-08 11:14
Johan Hakkesteegt31-Oct-08 11:14 
AnswerRe: BLUETOOTH VB.NET Pin
SilverGold3-Sep-12 9:47
SilverGold3-Sep-12 9:47 
QuestionWhat tools/scripts are available to automate migration? Pin
emunews31-Oct-08 3:21
emunews31-Oct-08 3:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.