Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

How To Change Pixel Size ?

Can we change the pixel size ? If yes how can we do it through VB ?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Change Pset Pixel Size
how can i change the size of a pixel i paint when i use Pset?

Kat (karen)

Attempting To Change/generate Pictures Pixel-by-pixel At Run-time...
Hello all,

I am fairly new to VB (especially using ActiveX with VB), and I am attempting to make a little tile-based RPG (like Dragon Warrior or The Legend of Zelda). Anyway, I am wondering how to change StdPicture objects at run-time.


Each tile has its own graphic (StdPicture object). I would like to be able to call a sub that takes this StdPicture and then increases the amount of red (RGB color) in the image. I can get this to work for pictures in PictureBoxes, but I cannot figure out how to do this with StdPicture objects. Any help would be appreciated.

Thanks -- ^iMp^

Get The Pixel Size Of A Picture.
Hi there,

I have an picture with the pixel size is (99 x 131), I load it in a picturebox(autosize=true) then using these lines of code to get its width and height:

msgbox picture1.width
msgbox picture1.height

and I get these values : 1485, 1965

How can I get the actual size(99,131) of this picture in my code ?

Thanks a lot.

Pixel Size Of Text
does anyone know how i would find the pixel size of some text, regardless of font.?


Form By Pixel Size?
Ok this might be a stupid question.

I am creating a form and adding a flash movie to it. I would like the movie to fill the form.

The movie was designed to be played inside a web popup which was originally designed at 570x295 pixels.

However, in vb, form sizes are not by pixel, right? For instance, height and width of a form goes into 3000's or so to get anywhere near that size.

What is the conversion? How would I make a form be 570x296 pixel size?

String Pixel Size...

How do I get the width and height in pixels of any given string?

Changeing Pixel Size?
I am useing the api setpixel, how can I change the size or the pixel?

Image Pixel Size?
Is there any way in VB6 to find (and display) a jpg image's pixel width and
height when displayed?

How Can I Fix Size Of A Form By Using Pixel?
I set scalemode=3,but the size of form is still measured by tips.what should i do if i want to
set the width of a form with the width of 800
pixels?thanks in advance

Calculating Size Of A Stretched Pixel
I'm using stretchblt to zoom in on a bitmap.

I'm trying to calculate how many pixels now make up what was once 1 pixel. Unfortunately, what I'm calculating and what StretchBlt is giving me are different. I don't have a good understanding of how StretchBlt works so maybe someone will see what I'm missing.

My example:

I'm selecting a box of pixels 20 X 20. I'm stretching it to 525 x 529.

So for my calculation of how many pixels will make up what was 1 pixel in the 20X20 image I used the following:

' NewPixWidth = OldWidth / NewWidth
26.25 = 525 / 20

However, when I look at the actual width that StretchBlt created a pixel is 25X25. This is causing me errors in my App because I am trying to calculate exactly which pixel of the unzoomed bitmap I'm on.

I think it is probably something in the way I'm calculating my new pixel width.

Does anyone have any ideas?

How To Size The Form Location In Pixel Value?
It makes me so confuse that,
The location setting(Top, Left) value seems not in pixel.
My resolution is 1280*1024.
but when I set left=700, the form is out of the screen!
How can I set it( or convert the pixel to that unit?)?

Besides, anyone can tell me how can I get the window size of EXCEL ?

Thank you so much!

Actual Drawn Pixel Size
There has been recent discussion on the XTVB forum here about the use of the TextWidth() and TextHeight() functions of the Form or a PictureBox. (These are also available in a UserControl). I have used these functions many times and know that they return values that are related to the text string being painted in a current font.

But these also return values that are closely related to the metrics of the font itself and not the actual pixel image of the text string. For example the TextHeight() will return the same value for a ".." string or for a "``" string. In a similar manner the TextWidth() will return values that include the horizontal spacing to the left and right of the glyph images includiing the excess right side or left side spacing that may exist in some fonts for strings like ")" or "(".

What I want to ask if anyone has done any work or discovered a API method for getting the actual drawn pixel height and width extents for a string as opposed to the values related to the font metrics. Clearly it is possible to actually 'Print' the text into a PictureBox and then scan the result (within the range of the TextWidth() and TextHeight() values) and look for the first non-background color columns from the left and right and rows from the top and bottom. However such coding in VB can be rather show in execution if this result is needed in certain cases that change dynamically in response to user mouse action.

For Example: I was working on a specialty re-sizable User Control where I was desiring to display a symbol from the Marlett Font on the user control such that I could maximize the symbol size on the control surface as opposed to accepting all the "white space" around the symbol. The attached image shows on the left what I would get in a certain sized bounding box if I scale the font size according to the TextHeight() and/or the TextWidth values when instead I want to scale the symbol image itself to the bounding box size.

Any suggestions???

Finding Out JPG's Size In Twip/pixel
GooDay everyone.

using CommonDialog to load a picture file like so:
VB Code:
CommonDialog1.Filter = "Picture Files (*.jpg;)|*.jpg;"CommonDialog1.ShowOpenPicture2.Picture = LoadPicture(CommonDialog1.FileName)
need to make sure the picture is in correct measurements.
i.e., in Twip mode, Width=570twip, Height=915twip.
in pixel mode, Width=38pxl, height=61pxl

any ideas on how i get this measurement info??

thanks in advance for any help.

Courier New Has Different Pixel Heights For Same Point Size On Different Printers?
I'm new at using the printer object. After going thru very close attention to making sure I could print a text page to certain spec's, things went to pot while testing on a different printer.

I need to know this because I am giving option to reprint any of the pages.

Are there different point heights using the same point size on different printers? I'm only using "Courier New" between 7 and 10 points.

If so, how do I determine what the point heights are?

Appreciate you answer and thanks

Find Size Of Picture Int Html File Based On Pixel
I would like to make a program which it will take as input a whole Html file and will compute the total size of text and pictures. I consider that a simple html file consists of simple text (data) and some pictures. My goal is to parse the Html file and calculate the amount of size of text and pictures.
For example the program must, if the total size of Html file is 10KB, to generate an output where the Size of text(data) is 3KB and the Size of Pictures is 7KB.
One of mine main problems is how to measure the size of pictures. Probably this task demands a procedure where it converts the pixel to bytes.


1. Navigate to a web page posted on the internet someplace
2. Find out the number of bytes that make up the html file itself (the ascii of the html page).
3. Find out the number of bytes that make up what has been added/included with the html file (meaning pictures).
4. Take 2 and 3 and add them together to get a final result of total bytes.

Could aynone give me a hand of help?

Could anyone give me a hand of help?

Monitor Pixel Colour Change
Is it possible to make an application that will monitor a webpage, to notify the user when a certain pixel on the page changes colour.

Unsure about this.


How Do I Change The Color Of A Pixel At Coordinates X,Y?
If you read my post about moving an imagebox you know that I have a nImagebox with a picture of a pencil in it, the last post was about how to drag said image with the mouse, now for my new problem.
as the user drags the image I want it to change the color of the pixel located at the .top and .left of the image box. this way as the user drags the box they draw a line.

Tell me, and i will forget...
show me, and I will remember...
Involve me, and I will learn...


PictureBox Size Change With Form Size [Solved]
I have a toolbar and a statusbar on my form, i want the size of the picturebox to follow the size of the form. So this is my code

Private Sub Form_Resize()

If Me.WindowState <> 1 Then 'not minimized
    On Error Resume Next
    Picture1.Top = Toolbar1.Top + Toolbar1.Height
    Picture1.Left = 0
    Picture1.Width = StatusBar1.Width
    Picture1.Height = StatusBar1.Top - (Toolbar1.Top + Toolbar1.Height)
End If

End Sub

This works perfect if the window state is 0 (normal) if it is maximized the size of the picturebox is the same as it was before i maximized.

Below is the testcode

Edited by - on 6/16/2004 6:37:13 AM

Form Size Change With Screen Size

I Want Change My Form Size On Different Resolution ( 800*600, 1024 *768 )
Please Help

Popupmenu Background Color Change As Well As Font Size Change
hi folks
am creating one popupmenu using createpopupmenu() API
and also i insert items dynamically using insertmenuitem API
and display using Trackpopupmenu().
My problem is

1)i want to change the background color of popup menu?????
2 i want to change the font size in popup menu ???????
dynamically .
if any body know API or how to change the font size and change the background color in popupmenu ,please help ur friend.

I don't need menu editor.
i need only popup menu.
expecting a positve reply.

Newbie Question: Changing/generating Images Pixel-by-pixel As Runtime?
Hello all,

I am fairly new to VB (especially using ActiveX with VB), and I am attempting to make a little tile-based RPG (like Dragon Warrior or The Legend of Zelda). Anyway, I am wondering how to change StdPicture objects at run-time.


Each tile has its own graphic (StdPicture object). I would like to be able to call a sub that takes this StdPicture and then increases the amount of red (RGB color) in the image. I can get this to work for pictures in PictureBoxes, but I cannot figure out how to do this with StdPicture objects. Any help would be appreciated.

Thanks -- ^iMp^

Convert 24bit Pixel To 8bit Pixel
Hi guys, i've got a simple question: how can i convert a 24bit pixel into a 256 (8 bit) color pixel?


Move Pixel By Pixel And Watch For Collision
does anybody know a good way to code pixel by pixel movemnts in a tile based game and while he is moveing he needs to look to see if the tile he is about to move on is passible or not.. currently i am useing the RECT type and intersectrect but i seem to be having a hard time makeing it look forward a move in that technique.. Please if you have an idea or a way i could code this please let me know

DB Size Does Not Change ??
hi all,

i was working on a code to upload my outlook mails to an access database. i managed that ... and i realised my access DB size swelled. So i went to the tables and deleted all the records manually. and now all my tables are empty. But my DB size does not change .... its still some 300MB.

can any one tell me whats happening here ??

to over come it i can just delete the DB and recreate a new one with the same structure, but i am curious to know.

thanks once again all you guys


Edited by - cjvinod on 1/24/2005 4:36:57 AM

How To Change The Title Bar Size
I want to remove the default icon from the left corner of the title bar of the vb form. By modifying the BorderStyle property the icon is removed but the title bar height also reduces.

How to change the title bar size to normal size or to remove the icon without affecting the size.


Change The Size Of Tabs
How do you change the tab sizes in a richtextbox??

Change Paper Size
what is the cording to change paper size and set as landscape .. what is the right cording i m trying like this

printer.papersize = 9
printer.oriantation = 2

its not working
y is that ??

what should i do

How To Change A Varchar Size ??
I need to change the size of two fields in my table. The existing sizes are not big enought. I tried using this code but it generates an error:

ALTER TABLE table1 {
ALTER COLUMN Field1 varchar(55),
ALTER COLUMN Field2 varchar(20);

And by increasing the size of the fields affect the existing data?

Change Field Size With DAO 3.5
Is it possible to change the size of a textfield, using DAO 3.5?

using the following alter table statement only seems to work with DAO 3.6.

ALTER TABLE Authors ALTER COLUMN Author varchar(57);

Change Font Size In RTB, But Not All Of It!
I have the code below to change the size of the selected font in a RichTextBox.

If the user selects a different size font part way through using the RTB, how do I get the text from that point on to be the newly selected size?
I have a combobox with the sizes available for the font.

Private Sub cmbFontSize_Click()
On Error GoTo ErrTrap

If Len(rtbNotes.SelText) > 0 Then
rtbNotes.SelFontSize = cmbFontSize.List(cmbFontSize.ListIndex)
''rtbNotes.SelFontSize = cmbFontSize.List(cmbFontSize.ListIndex)
End If

Exit Sub

[VBA] Change Size Of Label
I have an Access report. At the "onFormat" event I want to change the "height" of an element.
There is a line around this element (a box), so I check for the change of size.
So I tried:
Me.myElement.Height = 5
And this does work. I get a line (i don't even see the data).
But when I actually try to make the height very large for example 50, the maximum the box will grow on is whather space the text take.

How can I fix that ? Is there something I am doing wrong ?

The reason why I am trying to do this:
I have different info in my report
For example:
Info 1, Info 2, Info 3... and so on
When I generate my report each one of them is surrouned by a box (ie, border = solid).

Info 3 is a bit like a memo.
My problem right now is that the box around info 1 is not equal to the box around info 2 or info 3... I want to have all the boxes size to be equal to the largest.
So that's why I have to know how to set the height programatically so that when the report is generated it sets the heigh of the boxes to the height of the "tallest" box.
But if you have a way around let me know please !

thanks !

>>>>> UPDATE :
I fixed part of my problem.
I disabled the "Can grow" and "Can Shrink"
My issue now is for EACH detail i want to find the tallest size ( i know how to do that), but I don't know how in the "OnFormat" event do it for EACH detail in the report... right now it does it for everything... all the details box are the same....
please help,


I did figure out to force the size of the fields. (the cangrow and canshrink have to be set to false)
My problem is that I want all the fiels to be the same size as the field with the tallest size.
The fields (Memo, and Description) are the tallest one no matter what.
So I want to do a check to see which one of the two is the tallest and then set the size of everything else equal to the tallest.

So right now I have in the OnFormat event:

If Me.Memo.Height > Me.Description.Height Then
Me.Field1.Height = Me.Memo.Height
Me.Field2.Height = Me.Memo.Height
Me.Field3.Height = Me.Memo.Height
Me.Field4.Height = Me.Memo.Height
Me.Field5.Height = Me.Memo.Height
Me.Field6.Height = Me.Memo.Height

Me.Field1.Height = Me.Description.Height
Me.Field2.Height = Me.Description.Height
Me.Field3.Height = Me.Description.Height
Me.Field4.Height = Me.Description.Height
Me.Field5.Height = Me.Description.Height
Me.Field6.Height = Me.Description.Height

End If

Right now this does not work.
BUT if I give a number instead of "Me.Descriptionm.Height" or Me.Memo.Height
Everything works properly.
I think it's because I have to write the code in a way so that it's applied to each "detail" iteration. I am not sure how.

The other problem is that the Memo and Description field are both set to "Cangrow" yes.
So that I know big they get.
Let's say Memo is bigger than description. I will want to set Description at the same size as Memo.
But I can't, because "Cangrow" is set as yes. And it does not look like I can change this setting from VBA...

Please help, it's a bit hard to understand, but I have been stuck for a long time on this one.

I am doing all of this to have all the solid lines around the fields sized the same. Because if I enable the cangrow option, i will a nice box around each field, but each one of them is different size... so it's looks a bit weird for a "table" type report.

Thanks for your help

Picture Change Able Size
i currently have a small doodle program but i want to be able to change the canvas size, like in MSpaint you can drag it to change size, how would i code this?

How Can I Change The Image Size
I drawed lots of regions and line inside of a picturebox using API. (around 150 regions filled by different kind of brush)

I wonder how can I change their size when i resize the picturebox. I try cls and draw again, the effect is not smooth as all the data are read from database.

Any good method?


Change Another Window's Size
Can I change another window's width and height from my VB application If I know the caption on that window?

Change Paper Size
How to get the Data Report height after loading the Report?
How to change the user difined Printing paper size in VB?

Why Can't I Change The Word Size ?
I set font.size = 24. But the word printed out is still very small.

How Can I Change The Paper Size???
Hi to all

I'm using VB6 and i make a report with the datareport (default of vb).

I 'm searching the Web to find how i can change the paper size of the printer that user select but nothing.

I have a report tha prints Folio - Letter but it hasn't the same margins with the vbprpsFOLIO.

When the user select a printer from print button ( In Microsoft DataReport) i want to change the paper size of that printer.

**Sorry for my bad English**


Ok sometimes in vb I want to make my list box a certain size and vb will automaticlly resize it to a different size but I want it a certain size and not vb changing it to a different size so could someone please tell me how I can have it so it will stay how ever I want it? I dont have autosize on... Thanks guys I appreciate the help

How Can I Change My Form Size To A4?
hello im printing the hacky way form.print, mua ha ha

how big is a page in the numbers form size is set in, i.e, i have a form.height = X and form.width = Y, what are X and Y for an A4 form?

cheers ears

Change Window Size
hi all,

hoe can i supress that the user can change the size of my form


Change Page Size?
How do I change the page size of a data report? I need 8.5"x14", but I can't figure out how to make it this size.


Change Paper Size Through VB
Hi all,

can anyone let me how to change the paper size through VB code dynamically as per requirement, ie some of my data reports are using letter size papaer some using legal and some A4, I have tried printer.paperSize but it is not working ,

Thanks in advance


Textbox Size Change In VB6
Hon'ble gurus,
Please suggest me how to increase the width of the textbox by the size of a character when you go on writing and decrease it by the same size when you delete a character.I am using VB6.


Change Font Size
Is it possible to change the font or font size of the VB IDE?

I.e. I want to lower the font size of the code editor so I can see more code on my screen at once. Hopefully, without changing my screen resolution.


Tristan Wolf

Confucious say, "Man who fight salmon should use right hook."

Change Field Size

I have a table where a field's size is set to '9'. I need to expand it to '15', by code.

I'm using VB 6 SP5, ADO, Access 97.


Fabio Centenaro

How To Change An Image Size?
Hi again...
I would like to know if there is a way to load a picture on a pictureBox and to make this picture the appropiate size as to fit on the pictureBox control dimensions...

Hope someone can help...

File Size Change
Is there a way to have a program detect when there is a change in the file size of a txt?

Change Size Of An Apps
I us the shell command in VB to run an application, but I want to control the size of the application in my code. E.g I run notepad, but the size is to big, of course I can change the size in notepad. But I want to control this from VB by e.g a button.

Reading A Bmp File Pixel By Pixel.
Hi i wanna create a game map using A-Star but i wanna do it using a bitmap.
so what i wanna do is load an image and by reading the color of each pixel adding a node on a grid describing the accesibility of each point.
The darker the more costly.

Disregard from the purpose ... im intrerested only in looping through every pixel


Copyright 2005-08, All rights reserved