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




StdPicture , PictureBox , Colors, And Language


Is StdPicture compatible with pictureBox? That is, are these valid procedures:

Picture1.Picture = LoadPicture(bmp on hdd)
StdPicture = LoadPicture(bmp on hdd)
Picture1.Picture = StdPicture
StdPicture = Picture1.Picture

Do StdPicture and pictureBox have the same format as a Bitmap? That is, if I load a non-bitmap image from the hard drive and save it as a bitmap data type, can that type then be loaded into StdPicture and pictureBox? Eg.

myBitmap = getFile(adt on hdd)
Picture1.Picture = myBitmap
StdPicture = myBitmap

Conversely, can you read image data directly to and from StdPicture, bi-passing the data type altogether?

Which is faster: StdPicture picturebox or a defined data type?

----------

Can the color picker like from CommonDialog1.ShowColor be placed on a form without the CommonDialogBox? How? I haven't found a control in the component list.

If you calcluate RGB values like this

red = lColor And &HFF&
green = (lColor And &HFF00&) / 256
blue = (lColor And &HFF0000) / 65536

how do you calculate hue, saturation and luminance?

hue = ?
sat = ?
lum = ?

----------

Is all this moot anyway? I mean, how long can we expect VB to continue working in the windows environment? The practice and logical exercises are fine but I've already heard that some older programs no longer run on Vista. So, like, are we flogging a dead horse here? I use VB because I got a good deal on it long ago... 'days' before MS announced its obsolescence! I'm not planning to jump ship yet, but if/when the time comes it'd be just my luck that whatever I invest in will go belly up with equal facility. When I got started with VB I picked up a Sams do it yourself in a few hours book... and have been reading forums ever since. But some days it's frustrating when so many basic concepts are just beyond easy reach. Is buying a book or two for VB at this late date a prudent choice? From what I can tell, the 'common' options today are vb net or cpp. Are we at a fork in the road and must soon choose between them, or can we content ourselves with the status quo... I'm not a doomsday sayer or anything but major changes in language and costly programs and books and countless hours of study every time bill gates passes wind forces me to question the direction I'm taking. I'm wondering what others think.

Thanks if you've read this far, and thanks again if you can answer any of the above.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Replacing Picturebox/stdpicture Colors
hi

i want to be able to replace the colors of a stdpicture object (basically the picturebox's picture property). i figure i can just write a function that takes an stdpicture object, replaces the colors and then returns an stdpicture object so that it can be loaded into a picturebox. how would i go about doing this?
i tried it using the point property but this is terribly slow.

thx for any help

oh and for another project, i want to do the same basic thing, only store the picture without pictureboxes but with a dc so that i can use it with bitblt. i have seen some code that does something similar to what i need, but #1 i cant figure out how it works, and #2 it doesnt seem to work correctly for me, although it works fine in the demo program :/
so i figure i should just write my own function to give me an idea of the concept behind it.

thx again for any help u can give me

StdPicture And PictureBox
I am having a little trouble understanding how "pix" is defined in the code below. Can you explain that? Thanks!!

Also...how would I use this code for passing in a StdPicture rather than a PictureBox. The "PicSrc.Point and PicDest.PSet" will have to change I suspect.

Public Sub Negative(PicSrc As stdPicture, PicDest As stdPicture)
For X = 0 To PicDest.Width / 15
For Y = 0 To PicDest.Height / 15
u = u + 1: If u = 4000 Then DoEvents: u = 0
pix = PicSrc.Point(X * 15, Y * 15) 'HAVE TROUBLE HERE USING STDPICTURE
UnRGB pix, R%, G%, b%
R = 255 - R
G = 255 - G
b = 255 - b
PicDest.PSet (X * 15, Y * 15), RGB(R, G, b) 'PROBABLY WILL HAVE TROUBLE HERE TO.
Next Y, X
End Sub

Manipulating StdPicture Without PictureBox Or Image
I am still :-) trying to manipulate hires bitmaps. I have been told I can use the StdPicture instead of the PictureBox. I have managed to write some code that works with the PictureBox, But haven't the slightest idea how to convert it to use the StdPicture.
If someone could point me in the right direction. I have searched but can't find any detailed info with examples about using stdpicture.
Here is a little bit of the code ,so perhaps you can see the kind of things I am trying to do. Keep in mind the hires bmp is to large to fit in picturebox, and access all pixels in original bitmap.

For CurntColumn = Int(Picture1.ScaleWidth / 1.5) To Picture1.ScaleWidth

Pixcolor = GetPixel(Picture1.hdc, UseColumn, CurntRowHeight)

SetPixel PictureBox1.hdc, UseColumn, CurntRowHeight, vbYellow


Picture1.Picture = LoadPicture(App.Path & "/" & sh1num & " Test.bmp")

StretchBlt Picture1.hdc, Picture1.ScaleWidth, 0, -Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbSrcCopy

Problem With Stdpicture,savepicture()+loadpicture(),picturebox,bitblt
Dim MyPic As StdPicture

hDesk = GetDesktopWindow()
hDeskDC = GetDC(hDesk)
BitBlt Picture1.hDC, 0, 0, Width, Height, hDeskDC, 0, 0, SRCCOPY

''''''''''''' HERE IS THE QUESTION '''''''''''''''''
SavePicture Picture1.Image, App.Path & "1.bmp"
Set MyPic = LoadPicture(App.Path & "1.bmp")
''''''''''''' HERE IS THE QUESTION '''''''''''''''''

Set m_Image = New cImage
m_Image.CopyStdPicture MyPic

Set m_Jpeg = New cJpeg
m_Jpeg.SetSamplingFrequencies 2, 2, 1, 1, 1, 1
m_Jpeg.Quality = CLng(40)

m_Jpeg.SampleHDC m_Image.hDC, m_Image.Width, m_Image.Height
m_Jpeg.SaveFile App.Path & "1.jpg"


it all works ok with SavePicture-LoadPicture() functions
BUT I want to speed up a little process and do not know how to directly send picture from picturebox to MyPic with out SavePicture-LoadPicture() functions

stuf like set mypic = picture1.image and so on does not work

Problem-ipicturedisp,stdpicture,savepicture()+loadpicture(),picturebox,bitblt
Dim MyPic As StdPicture

hDesk = GetDesktopWindow()
hDeskDC = GetDC(hDesk)
BitBlt Picture1.hDC, 0, 0, Width, Height, hDeskDC, 0, 0, SRCCOPY

''''''''''''' HERE IS THE QUESTION '''''''''''''''''
SavePicture Picture1.Image, App.Path & "1.bmp"
Set MyPic = LoadPicture(App.Path & "1.bmp")
''''''''''''' HERE IS THE QUESTION '''''''''''''''''

          Set m_Image = New cImage
         m_Image.CopyStdPicture MyPic

     Set m_Jpeg = New cJpeg
     m_Jpeg.SetSamplingFrequencies 2, 2, 1, 1, 1, 1
      m_Jpeg.Quality = CLng(40)

   m_Jpeg.SampleHDC m_Image.hDC, m_Image.Width, m_Image.Height
       m_Jpeg.SaveFile App.Path & "1.jpg"


it all works ok with SavePicture-LoadPicture() functions
BUT I want to speed up a little process and do not know how to directly send picture from picturebox to MyPic with out SavePicture-LoadPicture() functions

stuf like set mypic = picture1.image and so on does not work





Edited by - eugene2005 on 12/9/2005 5:03:19 PM

Problem-ipicturedisp,stdpicture,savepicture()+loadpicture(),picturebox,bitblt
Dim MyPic As StdPicture

hDesk = GetDesktopWindow()
hDeskDC = GetDC(hDesk)
BitBlt Picture1.hDC, 0, 0, Width, Height, hDeskDC, 0, 0, SRCCOPY

''''''''''''' HERE IS THE QUESTION '''''''''''''''''
SavePicture Picture1.Image, App.Path & "1.bmp"
Set MyPic = LoadPicture(App.Path & "1.bmp")
''''''''''''' HERE IS THE QUESTION '''''''''''''''''

Set m_Image = New cImage
m_Image.CopyStdPicture MyPic

Set m_Jpeg = New cJpeg
m_Jpeg.SetSamplingFrequencies 2, 2, 1, 1, 1, 1
m_Jpeg.Quality = CLng(40)

m_Jpeg.SampleHDC m_Image.hDC, m_Image.Width, m_Image.Height
m_Jpeg.SaveFile App.Path & "1.jpg"


it all works ok with SavePicture-LoadPicture() functions
BUT I want to speed up a little process and do not know how to directly send picture from picturebox to MyPic with out SavePicture-LoadPicture() functions

stuf like set mypic = picture1.image and so on does not work

StdPicture LoadPicture() Load Directly Into StdPicture Without SavePicture
Code:
Option Explicit
Private m_Image As New cImage
Private m_Jpeg As New cJpeg
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020



Private Sub Form_Load()
Dim hDesk As Long
Dim hDeskDC As Long
Dim bmp As String
Dim JPG As String
Dim q As Long



hDesk = GetDesktopWindow()
hDeskDC = GetDC(hDesk)
BitBlt Picture2.hDC, 0, 0, Width, Height, hDeskDC, 0, 0, SRCCOPY

' i dont want to use this function
SavePicture Picture2.Image, bmp

Set m_Image = New cImage
' how to make stdPicture from this BitBlt Picture2.hDC, 0, 0, Width, Height, hDeskDC, 0, 0, SRCCOPY
' so I would not have to SavePicture and LoadPicture to m_Image.CopyStdPicture
m_Image.CopyStdPicture LoadPicture(bmp)

Colors In Picturebox
hi

i was wondering if it was possible to make the word prints in red when it appears
in the picturebox



VB Code:
picMessage.Print "Strike 3 !! Your Out!!"


i want to print the message in Red when it appears in the picturebox

thank you

Two Colors In A Picturebox.Is It Possible?
How would one, if possible, have 2 different text colors printed to a PictureBox?

Invert Colors In Picturebox
Hello everyone,

I have a picturebox which I use for a graph. I have several lines in it and are drawn with different colors. The picturebox's backcolor is white, and what I would like to do is to invert all colors in the picturebox without having to re-draw the graph. Is there a way to do so?

Painting In A PictureBox With Several Colors
I need to pint several parts of a picture box with different colors.
I'm using the ExtFloodFill function.
The question is, do I have to create a new brush every time I need to change the color?
For example, Combo3 has a few colors:


VB Code:
Private Sub Combo3_Click()    crNewColor = Combo3.List(Combo3.ListIndex)    DeleteObject mBrush    mBrush = CreateSolidBrush(crNewColor)    SelectObject Picture1.hDC, mBrushEnd Sub

Is this correct?
Is there any better way?

Replacing Colors In A Picturebox...
A quick question:
How do I replace a color in a picturebox? What method is the fastest? Any answers, suggestions, and flames are welcome.

Invert Colors In Picturebox?
Hello,
I'm loading a bmp at run time into a picturebox, I'm trying to inverse its colors, its a 2 bit bmp so all white bits should be black and the black ones white

I already tried this:

Code:

Me.Picture1.Picture = LoadPicture(sFileOut)
Me.Picture1.DrawMode = 6 'invert

Me.Picture1.Refresh


what could I do? thanks


here is how:


Code:

Me.Picture1.Picture = LoadPicture(sFileOut)
Me.Picture1.PaintPicture Me.Picture1.Picture, 1, 1, , , , , , , vbDstInvert

PictureBox To Accepts Pictures That Has Only 2 Or 3 Colors.
I want my PictureBox to accept pictures that has only 2 or 3 colors. For example, if the picture in a PictureBox has more than 2 colors, it will discard the picture by using the default one. Is it possible?

How To Change Header Colors And Listitem Colors Like Row With Same Color,hide Particular Column In L
How to Change Header Colors and listitem colors like Row with Same color,hide particular column in Listview control

Please Respond ,Urgently

Getting Current Keyboard Language Language (english , German Etc.)
Hello !
i have a form where the user writes his login and password.
I want to make something like WinXP does.
If the keyboard language is other than the default one then
msgbox you have for example German language activated on your keyboard.
Therefore the password you are writing might not be the one
that is needed.

do you know how to get this setting ?

thanks

How To Set Language , Input Language For System , OS , For User
Hi All,
Problem: Set language for a User / System on windows 2000

I have a following task:
There are 4 Input langauages installed on a Windows 2000 machine. Say those are English , Spanish, Dutch , Norwegian. And default user langauge is English. I need to set any of the remaining 3 languages as default language for user. It should be for user and not specific to my application. All other applications should also get the same language.

I tries with LoadKeyboardLayout , ActivateKeyboardLayout API. But those are specific to current process and thread. I also tried with SetLocaleInfo API. But I couldn't make it work.

Does any one has any solution to set Language setting for User or System and not specific to current process.

-Kets

#How To Change Locale Language And System Language #
How to Change the Locale and System Language setting of control panel through visual Basic Code.

Setup Uses My Language, Not System Language?
Hi,
Just had a french guy coming in, experiencing problems when installing my software on his Windows XP system. Haven't looked at the source of the Setup-Problem yet.
My question for now is, why are all the labels/messages created by the setup in the language of my system (German) instead of the system where the setup is running?
Are other Setup systems better (I'm using the one from VB6 itself), or can I make my Setup use only English (even French guys should understand that).

Form Colors To GrayScale Then To Colors
how would i tint everthing on a form to the greyscale of its origonal color and then back again? Giving a form a lost focus look without closing it?

Thanks

Matt

HDC From Stdpicture
I'm making a small game and in order to keep my program all neat, I want to load a picture into an std and use that variable as a source from which I can copy it from using bitblt. To do this, I need the hDC and the stdpicture variable doesn't have that. What do I do?

Thanks,
-Dion

Stdpicture
what is the default value of an stdpicture variable

OLE -> STDpicture
HI.

As most of you know. A STDPicture takes
OLE Automation to run. Now I would like
to know if there is another way to store
a picture in a variable other than that,
so I dont have to use OLE. Thanks!

StdPicture
HI.

I am trying to take a STDPicture and look at the
picture pixel for pixel! Is there anyway to do that?



Code:

'Assume all variables are declared
Set Buffer = LoadPicture(fPath)

X2 = Buffer.Width
Y2 = Buffer.Height

For X = 0 To X2
For Y = 0 To Y2
'Detect (x,y) pxel here.
Next Y
Next X

StdPicture
Hi all

StdPicture has Width & Height properties. They are measured in OLE_XSIZE_HIMETRIC & OLE_YSIZE_HIMETRIC units. Does anyone know how could I convert those units in pixels?

Thanks, thinman

Stdpicture Object
Hai all

What a stdpicture object?
What is the diffrent between the other controls that have a picture property and the stdpictue object?

What situation i shoud use an stdpicture object?

Thank you

IPictureDisp / StdPicture
what's the difference between IPictureDisp and StdPicture

StdPicture Problems!
hi, i'm trying to merge two jpgs together...

however, my StdPicture object doens't seem to have the PaintPicture function!

Dim stdpicture1 As New StdPicture
Picture1.PaintPicture LoadPicture("C:output00.jpg"), 1000, 1000
Picture1.PaintPicture LoadPicture("C:output01.jpg"), 1000, 1000
Picture1.AutoRedraw = True
Picture2.AutoRedraw = True
stdpicture1.Width = Picture1.Width + Picture2.Width
stdpicture1.PaintPicture Picture1.Picture, 0, 0
stdpicture1.PaintPicture Picture2.Picture, Picture1.ScaleWidth, 0

it gives me an error when i run this code!

BitBlt To StdPicture
I'm trying to BitBlt a screenshot to a StdPicture variable without using any pictureboxes. Here is my code:

Code:
Option Explicit
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Type PicBmp
Size As Long
Type As Long
hbmp As Long
hPal As Long
Reserved As Long
End Type
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" _
(PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, _
IPic As IPicture) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, _
ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SelectObject Lib "gdi32" _
(ByVal hdc As Long, ByVal hObject As Long) As Long

Private Function GetImage(ByVal wndHwnd As Long, _
ByVal xPos As Long, _
ByVal yPos As Long, _
ByVal iWidth As Integer, _
ByVal iHeight As Integer) As StdPicture
Dim bufDC As Long, bufBMP As Long, tmpDC As Long, G As GUID, p As PicBmp

' create buffers
tmpDC = GetDC(wndHwnd)
bufDC = CreateCompatibleDC(tmpDC)
bufBMP = CreateCompatibleBitmap(tmpDC, iWidth, iHeight)
SelectObject bufDC, bufBMP
' get image
BitBlt bufDC, 0, 0, iWidth, iHeight, tmpDC, xPos, yPos, vbSrcCopy
' convert BMP to StdPicture
With G
.Data1 = &H20400
.Data4(0) = &HC0&
.Data4(7) = &H46&
End With
With p
.Size = Len(p)
.Type = vbPicTypeBitmap
.hbmp = bufBMP
.hPal = &H0&
End With
OleCreatePictureIndirect p, G, True, GetImage

' With Picture1
' BitBlt .hdc, 0, 0, iWidth, iHeight, bufDC, 0, 0, vbSrcCopy
' .Refresh
' End With

' delete buffers
DeleteObject bufBMP
DeleteDC bufDC
ReleaseDC wndHwnd, tmpDC
End Function

Private Sub Command1_Click()
With Picture1
.AutoSize = True
.AutoRedraw = True
.Cls
.Picture = GetImage(Me.hwnd, 10, 10, 50, 50)
.Refresh
End With
End Sub

The actual BitBlt is successfull (test code commented out) and the convert to StdPicture *appears* to be ok as the display picturebox resizes BUT doesn't show an image. I know i'm missing something simple here but seem to be suffering from brain fuzz!!

Save An StdPicture To A .bmp
I've tried searching (mostly through this forum), and I've read several F.A.Q.s, but somehow I've missed wherever it says how to do this. I have an stdPicture called picOfMap. I thought I saw somewhere that you can create a PictureBox and load an stdPicture into it as below, but when I try it this doesn't work. I also don't know if the following code, for saving it, will work.


Code:
Private Sub mnuSaveBitmap_Click()

Dim toBeSaved As PictureBox

'picOfMap is an stdPicture
toBeSaved.Picture = picOfMap 'I know this line doesn't work. Don't know why
SavePicture toBeSaved, "C:DataMATS_filesSaveFiles" ' I can't yet tell if this line will work.

MsgBox ("This is where, in version 4.0, you're going to be able to save the bitmap")

Exit Sub
*Edit: Version is 6.0

BitBlt Onto StdPicture
Hi there, how would I go about bitblting to a StdPicture? I dont want to have the bulk of a picturebox just to copy the odd image onto for storing temporarily, so I heard I can use StdPicture instead, but I have no way of getting it into Pixels as its "scalemode" or even how to bitblt to it.

any help is appreciated.

Resize A StdPicture
Hello you all. This is my first post in here. People here seem to know his stuff. Please excuse my poor english, and moreover my poor VB.

Here is my question:
- I have a Form1 in which I would set a background (Form1.Picture).
- I have a picture, loaded in a StdPicture variable.
- I can't use other graphic controls, such as PictureBox or Image controls.

First code:
Code:
Option Explicit
Dim pic As StdPicture

Private Sub Form_Load()
Set pic = LoadPicture(App.Path & "" & "nsfondomod.gif")
Me.Picture = pic
End Sub

Private Sub Form_Resize()
If Not Me.WindowState = vbMinimized Then Me.Refresh
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set pic = Nothing
End Sub
This loads a picture as it is. If I have a picture that is smaller than the form, it doesn't resize it. I tried some combinations of the pic.Render method, such as
Code:
Dim pic As StdPicture
Private Sub Form_Load()
Set pic = LoadPicture(App.Path & "" & "nsfondomod.gif")
pic.Render Me.hDC, Me.ScaleLeft, Me.ScaleTop, Me.ScaleWidth, Me.ScaleHeight, 0, 0, pic.width, pic.height, ByVal 0
Me.Picture = pic
End Sub
but nothing has changed the pic size. I experienced also a "Not valid use of property" error when I tried to set the pic.Width/pic.Height properties.

Second code:
Code:
Option Explicit
Dim pic As StdPicture

Private Sub Form_Load()
Set pic = LoadPicture(App.Path & "" & "nsfondomod.gif")
End Sub

Private Sub Form_Paint()
Me.PaintPicture pic, 0, 0, ScaleWidth, ScaleHeight, 0, 0, , , vbSrcCopy ' (1)
End Sub

Private Sub Form_Resize()
If Not Me.WindowState = vbMinimized Then Me.Refresh
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set pic = Nothing
End Sub
This works great with pic size, but has a little bug: if I use a picture that has a transparent area, it draws the transparent area as white.

I would like the capability to do both filling all the form with the stretched picture and to mantain the existing transparency of the bitmap.
Is it possible? How can I do?
It's a week I'm cranking my head on this, I want to thank you all in advance for any help you'll give me.

StdPicture To DD Surface
How would i take an StdPicture and put it on a DirectDrawSurface7?

thanks

StdPicture Sizing
How to resize a new stdpicture?

StdPicture To Direct3DTexture8, The 'right' Way To Do It?
Im using VB6 and DirectX 8 (D3D) and have many textures already loaded as StdPicture objects (I dont have them in files, because they were assembled from pieces, and I need them as StdPicture in the first place). So when going into Direct3D mode, I need to convert these to Direct3DTexture8 objects.

Right now im saving every StdPicture to a temporary file and load it using CreateTextureFromFileEx(), but this is slow and it doesnt look like the 'proper' way of doing it IMO.

Does anybody know more elegant ways to do this? (Its VB, but I can use C/C++ in a DLL to make fast things like math or memory operations)

Thanks for any ideas!

Property Let And Get For StdPicture
Hi!

I'm making ActiveX Control, and i need property Picture as StdPicture.

If i declare Picture like that:

Code:
Public Picture as StdPicture
i can load picture into variable (when i use this User Control in form) just like in Picture control, but my UserControl does not know that new picture is loaded, so nothing happens.

That's why i'm trying to use Property Get and Property Let, but here is problem.

My code:

Code:
Private sPicture As StdPicture

Public Property Get Picture() As StdPicture
Set Picture = sPicture
End Property

Public Property Let Picture(ByVal vNewValue As StdPicture)
Set sPicture = vNewValue
End Property

In that case everything works fine until i'm trying to load picture.
I get error: Wrong number of arguments or invalid property assignment!

What should i do?

Thanx for help!!

!! StdPicture Properties?!!
Does anyone know how to get CORRECT width and height of a stdPicture object? My problem is something like this:

Dim picture1 As stdPicture
Set picture1 = .... (get the picture from some source)

MsgBox(picture1.Width)
MsgBox(picture1.Height)
Call SavePicture(picture1, ".../mypic.wmf")

Ok this all works fine, it shows 2 message boxes, it saves. The problem is that mypic.wmf's dimensions are actually much much different to those that come up in the MsgBoxes!

i.e. What I'm doing, or am trying to do is that I'm getting the picture object from a source, which for the purposes of this question might as well be a Picture Editor;

+-------------------------------------------------+
|@@@@@@@@@@@@@@@@@@@@@@@@@@@|
|@@+--------+@@@@@@@@@@@@@@@@@@@|
|@@|@ A @@|@@@@@@@@@@@@@@@@@@@|
|@@|@@@@ |@@@@@@Working Area@@@@@@|
|@@+--------+@@@@@@@@@@@@@@@@@@@|
|@@@@@@@@@@@@@@@@@@@@@@@@@@@|
+-------------------------------------------------+

The dimensions returned by picture1.width and picture1.height are the dimensions of the Working Area; but what I really want is the dimensions of 'a' -- the only thing that's in the picture1 object!

If I save this picture1 object as some WMF file, and open it again in, say, Paintshop Pro, -- it'll give the PROPER and REAL dimensions -- i.e. the dimensions of 'a'. But if I reload the WMF file back into VB and call width and height; it's still giving me the WORKING AREA's dimensions!

Please help! Anyone who knows how stdPicture works and how vector graphics works in this context!

Stdpicture Size
hi, what measurement is used for the stdpicture sizes, EG.

picture1.picture.width

is that measured in, pixels, twips? what? i cant seem to find the correct measurement

Please help

How To Create New Stdpicture
I can't create new stdpicture . help me please!

Picture Box To StdPicture
I am drawing a picture realtime from thermal imager , my driver will write picture in picture box ,

i want tansfer picture box drawings to stdpicture object of stdOle ,

Dim x as stdPicture
dim picture1 as pictureBox


set x= picture1.image , works ,but only the container of the pciturebox with it background color comes in the stdPicture object ,Not the contents of the picturebox , means my drawing.

I found a Render method for stdPicture,

Do I need to use render method of Stdpicture like x.render(....) ?
does anyone know ,how to render from picturebox to stdPicture?


Thanks in advance,
Roy,
CNA Engineers Pte Ltd,
Singapore.

STDPicture And Variable Not Set
I am working on a Usercontrol and I need to detect if a my Var using STDPicture is set or not...

basicly like this:

Code Code:
if myImage is not set then exit sub

StdPicture Object
What is an stdpricture Object? Can Please explain me with a simple example?

Dimensions Of StdPicture?
Does anyone know how to get the dimensions (in pixels) of a picture stored in memory (StdPicture)?


VB Code:
Dim picTest As StdPicture Set picTest = LoadPicture("C:Some_file.bmp") 'Get dimensions?? :confused:  

StdPicture Resizing
Hi, I need a solution to resize a stdPicture without any VB controls.

I'm writting a graphic program that allow user to open their picture and edit it. I use stdPicture to load the image and tranfer to a huge byte array by this:


VB Code:
Public Sub LoadImage(SourcePic As StdPicture)    (..................)    GetBitmapBits SourcePic, ImgHeader.bmWidthBytes * ImgHeader.bmHeight, PixelBytes(0, 0)    (..................)End Sub


My problem comes when user change the image size (e.g. from 300x200 to 340x200), the program should be able to
1. resize the stdPicture to fit the new dimension
2. keeping the original image content (e.g. based on original image, just add 40 pixels to the right of the image.)

All of this is done within a class, so I cannot used any VB controls to achieve this. So far I stuck in step 1. Any help would be deeply appreciated.

IPictureDisp > StdPicture ???
how can i convert an IPictureDisp image to a StdPicture??

currently i am using a method like the one following:

Code:
Dim MyPic As StdPicture
SavePicture Picture1.Image, "c:123.BMP"
Set MyPic = LoadPicture("c:123.BMP")

this seems kinda dodge to me tho

thanks
Kris

Copy StdPicture
I have this function:


VB Code:
Function HueShift(picture As StdPicture, ShiftHue As Integer, ShiftSat As Integer, ShiftLight As Integer) As StdPicture Dim picin As New StdPictureSet picin = picture Dim hDCSrc As LonghDCSrc = CreateCompatibleDC(0)hBmpTmp = SelectObject(hDCSrc, picin) w = picture.width / Screen.TwipsPerPixelXh = picture.height / Screen.TwipsPerPixelY FoxHSL hDCSrc, 0, 0, w, h, hDCSrc, 0, 0, ShiftHue, ShiftSat, ShiftLight, 0, 0 Set HueShift = picin DeleteDC hDCSrcDeleteObject hBmpTmp End Function


Problem, is that the code Set picin = picture does not duplicate the image, so you image handles are the same the the HueShift that is done to the image referenced by picin is also done to the image refererenced by picture, therefore changing the picture that is inputted - which i don't want!

I need to be able to make a copy of the image and put it in a new StdPicture (I need some kind of method like clone() in java)

Any ideas?

DC To Stdpicture Object
Dear Developers,
How can I get a stdpicture object from a dc (device context) or is there any way to save the contents of a dc to a picture file ?

EvelinDev

StdPicture.handle ?
The StdPicture.handle is a handle to what ?

And could I convert that handle to a HDC handle ?

IPictureDisp Vs StdPicture
IPictureDisp vs StdPicture

Copyright 2005-08 www.BigResource.com, All rights reserved