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





See Related Forum Messages: Follow the Links Below to View Complete Thread

ListView Crop
Hello!

I am having some problems with creating a crop function for a ListView. At the moment, I am running a loop starting at 1 and ending at ListView.Count. Then, if the item is not selected, I remove it. However, after removing at least one item, the ListView.Count property changes and my code will throw out an error (index out of bounds).
Now I have managed to change the code a bit, but I think it is a dirty work-around and I thought that you might have a better answer.


Code:
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long

...

Private Sub mnuCrop_Click()

Dim lngCounter As Long
Dim lngListItems As Long

lngListItems = lvwFiles.ListItems.Count

If lngListItems > 0 Then
LockWindowUpdate lvwFiles.hwnd
For lngCounter = 1 To lngListItems
If lngCounter > lngListItems Then
LockWindowUpdate 0
Exit Sub
End If
If Not lvwFiles.ListItems(lngCounter).Selected Then
lvwFiles.ListItems.Remove lngCounter
lngListItems = lngListItems - 1
lngCounter = lngCounter - 1
End If
Next
LockWindowUpdate 0
End If

End Sub

Regards,
Sebastian Mares

Image Crop
I have a rather unique program in which I need to display a rather large quantity of pictures that have a very similar format (3 pictures per jpeg file). I was wondering if anyone knows how to crop sections of a jpeg and throw it in an image box. For instance if the user press command button one the image box displays a portion of pic1.jpeg (say 1,1,500,500) and command button two displays a portion of pic1.jpeg (500,1,1000,500). assuming the first two numbers are x and y initial and the last two numbers are x and y final so that a rectangular portion of the picture is displayed.

Thanks

How Do You Crop A Pic From The Center Of The Pic.
I need to load a bitmap in a Picture1 and crop to 125 x 43 form the center of the bitmap .

Another Problem Crop Up
anyone here know how to print elapsed data in excel using VB

Crop GIF And Save GIF/BMP
Okay, here is the question I have...

There is a a bunch of photos, that are exactly alike in every which way except for some information. These are sensitive documents that are scanned into GIF awhile ago. All the dimensions are exactly the same 672 by 874 pixels.

What I would like to do is split that document into 2 pieces: 672 by 437 pixels so now I have 2 graphics and then have them saved to 2 files.

Doesn't matter if it's GIF or BMP. I would perfer GIF because it would be apples to apples, but BMP is fine as well.

How would this be accomplished?

Thanks!

Chris

How To Crop The Image
hello i want to crop a image and also resizing the image
tell me the way
thanks
with regards
Hammad Umar

NEED HELP,PLEASE!,how To Crop A Picture Using Vb?
Are they anyone can tell me how to crop a picture using vb?
is there any way to do in VB?
if anyone knows please give me the code...thank you.
i am currently working with a mini picture vewer , i would like to let the user crop the picture as they use the mouse the highlight the range to crop the picture.
besides, anyone knows how to resize the picture but didn't affect the resolution of the picture instead of using "strecth" function.

I 'll be appreciate if anyone show me the code of cropping a picture and resizing a picture.

Crop Text
Hi have 3 pharagraphs:

blablabalbalbalblab
fdsafasdfhsldajfh
sfsdalfkhsljfksd
fsdfsldhfslhfsdfs

123456+7
asfsaf
asfsaflsk;ajfsa
fasfsajkl
123456+8+9

bobobobobo
fsdfsdafsad
fsdafsadfsa
dfsadf

(those are just example)

how do I cut everything above 123456+7
and everything bellow 123456+8+9?

Crop An Image
i need of code to crop an image in vb without any package files.

VB6 How To Crop The Image
hello sir,
    I'm working with vb6.0 .now i need a help in image. How to crop the image in our own size or particular standard size can anybody help me?
thanking you
siva

Did you know? You can CHAT without downloading messenger. Go to http://in.webmessenger.yahoo.com/

Crop Image [in Picturebox]
I have a tile image, 48x1024 or something of 48x48 tiles. I want to display only one tile inside a 48x48 picturebox.

Can this be done in vb6? Or do i need a custom reference or something to get this functionality? Essentially, all i need to do is crop a picture

Saving Crop *Error*
I am having a hard time with saving a picture after croping it. I keep getting error. If I dont crop the pic, it saves fine, but once I crop it and the crop opens in the Picture2 and I try and save it, the error shows up.

Here is the code that puts the croped picture into the second Pic box.

Code:
Private Sub Crop_Click()
PicCrop2.Cls
PicCrop2.PaintPicture PicNoCrop.Picture, 0, 0, , , X1, Y1, Width1, Height1
End Sub

The code to save the Croped Pic

Code:
Private Sub SaveCrop_Click()
CommonDialog1.ShowSave
If CommonDialog1.FileName = "" Then Exit Sub
SavePicture PicCrop.Picture, CommonDialog1.FileName
End Sub

The error I get
**RunTime Error**
Invalid Property Value
SavePicture PicCrop2.Picture, CommonDialog1.FileName

Can anyone help me out?

Crop Image Question
Hi,

I am working on an app that reads an image file from disk and loads it into a picture box. I want to be able to limit the size of the image, on the right hand side of the screen i have a picture box that scales the image down to fit in the dimensions I require. I would like to have a picture box on the left hand side where the user can crop the image to the dimensions I require. how would I create a dragable frame (of the dimensions I require) on top of my picture box to enable the user to be able to select the area they want to crop?

Thanks in Advance for any help.

How Do I Automatically Crop An Area
How do i automatically crop an area in Visual Basic 6.0
without using the mouse to crop the picture.
can you direct me to a good web site for help. or can any
one help me set the X1, Y1, X2, Y2 and on then put the
Area on the picture into another picture box. this i need
to be able to do with out the mouse.
i need to do automatiaclly, to crop an area with out the mouse.
Thank You

Crop A PNG File...VERY URGENT
IF any know how to crop a png file ....please tell me the code urgently....if anybody have the code please send me fast ....please help me me fast....

Crop Image In PictureBox
After I load an image to the PictureBox, can I crop the image to the size of the PictureBox? I will be saving the image to a bmp file and need the width of the image to be the size of the PictureBox.

Thank you.

Resize And Crop Images
Hi there!

I have a lil question for you. I want to make an app which could open an image (.bmp or .jpg, preferably), resize it to a size pre-set by the user, and then save it as a new jpg. I dont how a slightest clue about how to solve this (the image-resizing and the jpg-compression). Any suggestions or points to tutorials on this subject would be great.

Maybe this is subject for another thread, but I want that .jpg uploaded to a remote webserver aswell. If anyone knows how to do that, please drop me a line.

Thanks in advance!

Crop Internet Browser?
I placed a rotating banner from my website in my application. The problem is that I only want the browser to show the banner and none of the surrounding website. How can I crop the browser to show only the banner?

Crap... I Mean Crop File
Ok, i'm going directly to ask for the extreme:
Does anyone know how to remove the last byte on a 50M file?
As for my solution that would take a 15 sec, as it empties the file with output and rewrites it in binary.
I'm actually just working with mp3's but it's annoying amount of time (1-2) sec and the harddisk chattters alot.
AFAIK, vb, can't do it so giving me a dll made in c++ or something would be great.

Crop A Portion Of Image
How to develop a source code to crop a portion of an image?

H! Please Help Me.. Auto Crop Black Border
can you please post a code or please tell me how to auto crop a black border on an image which have different size of black border.

i've been working in vb with diffirent ocx.. I already use Tiff processor ocx and pixtin.. I think I could create a algorthim that could get the pixel of black border but the black border have different pixel(RGB).. ur help will be helpful thanks

Crop Graphs Imported From Excel
Hey guys,

I have a chart which is imported from an excel spreadsheet, problem is it has a heck of a lot of whitespace around it. The imagebox is big enough to handle the size of the graph, but with all the whitespace around itthe graph gets shunted half way out of site. Is there a way to crop the image to the size of the imagebox?

any ideas?

I am really new to VB so thats why I am asking.....

cheers

Creating Bounding Box To Crop Picture
I'm looking for an idea or some code that will let me have the user draw a bounding box to "crop" an image that is being displayed.

It would also be nice after the box is drawn to have the typical resize on the corners and move the box if the mouse is dragged in the middle of the seleciton options.

My eventual aim is to also be able to put dimensions on the crop - and be able to keep this bounding box at a specific aspect ratio.

Any places to get me started?

THanks

Using The Mid, Left, Right Function To Crop Off The File Extension
I'm starting out with a string called theFile that is the entire Path name of a file:

theFile = "o:1200550New FolderPartsTestfile-01.sldprt"

What I end up with is

strHistory = "1200550 - Testfile-01.sldprt"

How do I modify my following code to crop off that extension? I tried using InStr as a third statement in the second Mid$ function, but can't seem to get it to work.


Code:
strHistory = Mid$(theFile, InStr(theFile, "") + 1, 7) _
& " - " & Mid$(theFile, InStrRev(theFile, "") + 1)

Still Can't Find How To Crop An Image And Place It On The Clipboard
Hi.
I have been trying to find an answer to my issue of cropping images. I download an image from a camera. I load it onto my form with two picture controls and make a thumbnail of it on my form. That is fine. I wan't to also take the full size image and cut off the top and bottom (crop) so it is a new shape and I want that new image to be copied to the clipboard for use in another app immediately. I don't need the trimmed image to appear on my form.
Any ideas please?

How To Crop And Other Editing Tools To An Image Captured By Camera
Good day to all! Anybody knows what control/ocx to use when
editing captured image from pc camera, i have already worked on
capturing image but i cant edit the image taken with vb code,
just like cropping, zooming, brightness, contrast, etc...
Anybody help me.

"Auto Crop" Rich Text Box Lines Of Text....?
hi guys.

i have this code, which will remove the lines of text prior to the allowed number of lines.


VB Code:
Private Sub CropLines(RTB As RichTextBox, Optional LimitTo As Long = 200)    With RTB        Dim uberSplit, lenFirstLine        uberSplit = Split(.Text, vbCrLf)        If UBound(uberSplit) > LimitTo Then            lenFirstLine = InStr(1, .Text, vbCrLf) + 1            .SelStart = 0            .SelLength = lenFirstLine            .SelText = Empty            .SelStart = Len(.Text)        End If    End WithEnd Sub ' Called Like:'CropLines FormName.RTB, 150  


now i have 1 problem with this code.....

it scrolls up and down the rich text box to remove the line...

so, i was wondering, is there a method to do the same thing, but "INVISIBLE" to the user?

i really dont wanna have the log shoot up and down every time a message is added to my log window....

thanks guys
Wayne

Search For A String Within A String And Replace It With Another String
is there any prebuilt function that can do the above?

thnks

Show Position Of 'x' Instance Of A Text String W/in A Large/complex String
i 'thought' i saw a thread about this but i lost it.

for short easy strings, i can use this

sSource = "hello hello"
ipos = InStr(1, sSource, "hello")

the reult will be:

ipos = 1

and

sSource = "hello hello"
ipos = InStr(2, sSource, "hello")

ipos = 7

however, i have found if the string under consideration is large it doesnt seem to matter if the setting is InStr(1 ... InStr(2 ... InStr(3 ... or whatever. it will always show the position of the first instance, even though there are several instances in the string.

is there a reliable way to move to the 'x' instance of a particular text sting inside of a larger text string?

Reading Image Files Into A String Buffer(since API Function Supports Only String Buf)
Hai all,

im back with another problem!

I am using a API function which accepts data only into a string buffer. (InternetReadFile function in WinINet API).

I tried reading a JPG file from the cache and then writing it out again to disk. I didnt get back a JPG image.

So how do we work around the fact that InternetReadFile reads into a string buffer, but I need the data in a Byte() array, so that I can write back the JPG file properly to disk??

converting each character in the string to Bytes returned an error..


Code:


'Buffer is the string and data is the Byte()
For i = 1 To Len(Buffer)
data(i)= CByte(Mid(Buffer, i, 1))
Next



sorry if im missing something!

thanks for ur time..

Pradeep V

ReDim Preserve Adding String To String Array Causes Space In Bad Place
I have a chat program where the user has the ability to ignore certain users by typing "/ignore <username>". When they do this, the username will be added into a redimming (and preserving) string array. When chat information is brought through the winsock, it checks for the name in the array, and if it is there, it will not print the message. However, when I add the text, I check what the string is before it enters the array. For example, if I type "/ignore test" then the msgbox will display "/test/", the vertical bars are what I add in the msgbox, but are not part of the string. However, when it is searching the array, it pulls up "/ test/" with a space before the actual username.

Here is my code to check and what to do when:

Code:

Dim i As Long
        
        MsgBox lngIgnoreTotal '***
        
        For i = 0 To lngIgnoreTotal
            If lngIgnoreTotal <> 0 Then
                MsgBox "list= /" & strIgnoreList(i) & "/" '***
                MsgBox "mid= /" & Mid(strText, 3, (InStr(2, strText, ">") - 3)) & "/" '***
                If (" " + Mid(strText, 2, (InStr(2, strText, ">") - 2))) = strIgnoreList(i) Then
                    MsgBox "subaa" '***
                    Exit For
                Else
                    If i = lngIgnoreTotal Then
                        MsgBox "subab" '***
                        frmChat.rtbChatBox.SelStart = Len(frmChat.rtbChatBox.Text)
                        frmChat.rtbChatBox.SelColor = vbBlue
                        frmChat.rtbChatBox.SelBold = True
                        frmChat.rtbChatBox.SelText = Left(strText, InStr(strText, ">"))
                        frmChat.rtbChatBox.SelBold = False
                        frmChat.rtbChatBox.SelColor = vbBlack
    
                        frmChat.rtbChatBox.SelStart = Len(frmChat.rtbChatBox.Text)
                        frmChat.rtbChatBox.SelText = Mid(strText, (InStr(strText, ">") + 1), Len(strText))
    
                        frmChat.rtbChatBox.SelStart = Len(frmChat.rtbChatBox.Text)
                    End If
                End If
            Else
                MsgBox "subb" '***
                frmChat.rtbChatBox.SelStart = Len(frmChat.rtbChatBox.Text)
                frmChat.rtbChatBox.SelColor = vbBlue
                frmChat.rtbChatBox.SelBold = True
                frmChat.rtbChatBox.SelText = Left(strText, InStr(strText, ">"))
                frmChat.rtbChatBox.SelBold = False
                frmChat.rtbChatBox.SelColor = vbBlack
                
                frmChat.rtbChatBox.SelStart = Len(frmChat.rtbChatBox.Text)
                frmChat.rtbChatBox.SelText = Mid(strText, (InStr(strText, ">") + 1), Len(strText))
                
                frmChat.rtbChatBox.SelStart = Len(frmChat.rtbChatBox.Text)
            End If
        Next i




Any ideas why it does this?

bgp1
Brandon Parker
http://www.thejokes.net

Edited by - bgp1 on 11/23/2003 10:15:52 PM

Reading Image Files Into A String Buffer(since API Function Supports Only String Buf)
Hai all,

I am using a API function which accepts data only into a string buffer. (InternetReadFile function in WinINet API).

I tried reading a JPG file from the cache and then writing it out again to disk. I didnt get back a JPG image.

So how do we work around the fact that InternetReadFile reads into a string buffer, but I need the data in a Byte() array, so that I can write back the JPG file properly to disk??

converting each character in the string to Bytes returned an error..


Code:

'Buffer is the string and data is the Byte()
For i = 1 To Len(Buffer)
data(i)= CByte(Mid(Buffer, i, 1))
Next


sorry if im missing something!

thanks for ur time..

Pradeep V

String Manipulation (Extracting Alphanumeric Characters From A Mixed String)
If the value of something always contains both letters and numbers, how can I extract just the letters from the String?

GetIPFromHostName(ByVal SHostName As String) Returns Empty String?
Hi,
I guess this question is directed at Randy Birch, but as I haven't the
money to go help him move and clean up his house, I guess I don't have
the right to ask him directly... so here goes.

I'm using a chunk of his functions to resolve Hostnames into IP
addresses and MAC addresses and the like... all of it works fine -
except this function, and I have no idea why... Of course, you'll
probably tell me to kindly put the light sabre down until I'm a real
Jedi... but I don't think that's gonna happen - I'll never be a Jedi.

when I call this:

GetIPFromHostName(ByVal sHostName As String) As String

?GetIPFromHostName("Argentina")


?GetHostNameFromIP("10.0.0.83")
ARGENTINA

I get no value returned.

Am I just missing something? If so, could some kind soul clue me
in... I'd *really* much rather spend my time doing something useful
than walking around to each computer in the agency (all 100 or so of
them) and writing down stupid stuff I can tell the computer to do...

Thanks!
Pieter

How Do I Print Out A String That Has Double Quotes As Part Of String
Hi All,
I am attempting to build up a dos batch file in Vba, that has a series of commands to be executed, where both the path to the executable and the associated file name have spaces in them. Well, as I am sure you know, the DOS command interpreter fails when it sees C:Program files and complains that C:Program does not exist. I have figured out that enclosing all of my entities in " will do the trick, but how do I escape the " in my VBCode when building a string so that the " actually is printed out?

for example

str1 = "The box"

and I want it to print out as "The box", not The box

The print out is to an open file

Any help would be appreciated !

Thanks

Joe Finkelstine
jfinkelstine@centor.com

Find A String Line Wich String Value Is Unknow
'Hello

'You have probably meet this kind of question

Dim objWdRange As Range
Dim objWd1 As Range
Dim Num1 As Integer
Dim NumLines As integer

Selection.GoTo wdGoToLine, wdGoToLast
NumLines = ActiveDocument.BuiltInDocumentProperties(wdPropertyLines)
Selection.GoTo wdGoToLine, wdGoToFirst
Selection.Expand wdLine
Set objWd1 = Selection.Range 'receive the string of the first line
Selection.Collapse wdCollapseEnd
Do
Set objWdRange = ActiveDocument.Range(Start:=lStart, End:=ActiveDocument.Content.End)
With objWdRange.Find
.ClearFormatting
.MatchCase = True 'or False
.Text = objWd1 here is my problem I cant put a string because I dont know the
the value of this string .I but objWd1 as a variable .But as I have wrotten it is false .
'(NB to understand
purpose Every time I open a text , the macro must find all the lines wich have been repeated , deletes all the occurences save a line among
'them. )

bFound = .Execute
End With


'there is no bug but the string line seems not to be researched

If bFound Then
objWdRange.Select
Set objWdSelection = Application.Selection
objWdSelection.Expand wdLine 'selectionne toute la ligne
objWdSelection.Text = "not easy" & vbCrLf
objWd1.Delete
End If
lStart = objWd1.Start + 1
Loop While bFound

Anyone Have A Simple Function To Add A String To A Richtxtbox, And Color That String?
all the examples i can find on the net involve having 'keywords' that the app colors when they appear in a richtextbox

is there any way just so add a specific string to a richtextbox and color it?

Get String Displayed In A List, Search Array For That String
Hey there, I have a two dimensional array, first column has workshops, second column has the price for the workshop in that row.
Workshops are displayed in two lists, all 6 in list 1, and only 4 in list 2. I can't use ListIndex here and search the array for that,that wouldn't be correct.
So is there a way to get the name (string) of the list item selected and then search the first column of my array for that string and return the value in column 2 of that row?

EDIT:2nd part is easy with a loop, I just need help with the first part.

Thanks!

Christoph

Counting The Number Of Times A String Appears In Another String?
I have a string read from a text file, and I would like to fine the number of times a URL was used in it.

How would I go about doing this?

Thanks.

Extracting A String Contained Within A String/arithmetic On Times
Hi All !
I am pretty new to the world of VB so please forgive me if my questions are a little silly.

Basically i am building a radio playlist interface...and i need to know a couple of things.

Firstly i am using a combo box to select a track which appears in this format Track 1 ( 4.32) and then then it appears in the list box(playlist) when i click a button.
Though i also have 2 list boxes to the right of the playlist and in the playlist only 'Track 1' should appear while in the next listbox should appear the start time of the track (eg 0.00 for start of program, or 32.11 for 32 minutes and eleven seconds into the program), and in the other list box should appear the duration of the track which appeared in the initial combolist alongside trackname,
I know i have to extract a string from a string..but i am clueless as to how to do it and how to perform arithmetic on times !!!
Anyone got any suggestions ?
I know it's a big ask but any help would be much appreciated.

Thanks

HarpoonFace

Whats A Quick Way To See How Many Times A String Appears In Another String?
"how Hello how are you how are you how"

How can you tell that 'how' appears in this string 4 times?

Anyone Have A Simple Function To Add A String To A Richtxtbox, And Color That String?
all the examples i can find on the net involve having 'keywords' that the app colors when they appear in a richtextbox

is there any way just so add a specific string to a richtextbox and color it?

Is There A String Function To Extract Values From A String Into An Array?
Is there a function in VB.NET or VB that can take a string of comma-separated values (or values delimited by any other character) and extract the individual elements into an array?

Converting A String With No Spaces To A String With A Space *RESOLVED*
Ok, this might not be too difficult but I could be wrong. I've got a resource file with a bunch of bitmaps. I wanted to name them like so "ALS 1201" with a space to match the caption on a button. That way, I can just call the resource file with the command1.caption as it's ID. However, the Resource Editor doesn't allow spaces when giving an item an ID. So, is it possible to have the program grab the command1.caption ("ALS 1201"), take out the space ("ALS1201"), and search for a resource file with that name?

RESOLVED .Empty String, Null String, How To Evaluate
Placed my question in ActiveX board.
But no one is looking over there.

My question

Thanks for helping me out.

Setting The String Length 'Dim StrInput As String * 2000
Hello,

Is there a way to dimension a string length using a variable.

Ex:

Dim strInput as String * 2000

>>Would like to get the same result as above using:

Dim strInput as String * intLength

>>I know VB6 requires a constant but is there a way to set the length of 'strInput' using a variable some other way.

Thank you....

Creating One Long String From Db And Putting That String Into A Textbox
Hi everyone,

I have a search function that works just fine. However, what I want to do is add all the resulting records into a text box. Like 1 long string with separators formatted into the textbox as well. The resulting string will only be at most 5 or so records. And each record as displayed is about 10-15 chars long. some a lot less some slightly more. My problem is, as I loop thought the recordset, I end up with only the last recordset in the textbox.

I was thinking of concatenating (sp) each recordset, but have been unable to get a sub to do this. No matter what I have tried, it just ends up being the last record in the recordset displayed in the textbox.

Here is the sub I have so far. Now remember that I know my search string works in the db, I just cant get all the records into one textbox:

Code:
While Not adoPrimaryRS1.EOF

tmpStr = (adoPrimaryRS1!field1 & " " & adoPrimaryRS1!field2 & ":" & adoPrimaryrRS1!field3) 'String is formatted how I want EACH record to look

tmpStr1 = tmpStr

adoPrimaryRS1.MoveNext

TextBox1.Text = tmpStr1 & " $$ " & ???? ' not sure how to procede

Wend



As you can see, I am not sure where to go from here. If I just loop through the recordset, I end up with the last record displayed. I don't know if there is some sort of append function that I am not aware of that might work in this case.

Any help would be appreciated.

Thanks

Intercepter

How Can I Execute One String Selected From DB And Not Treat It As String?VBScript.
How can I execute one string selected from DB and not treat it as string?VBScript.

For example:
One record in the table is session("name").and I want to show the session variable's value.

thanks

How To Find A The Character In A String At A Certain Position In The String
how to find a the character in a string at a certain position in the string

such as:

hello

i want to find position 2 which is 'e'

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