Jump to content
Xtreme .Net Talk

mcerk

Avatar/Signature
  • Posts

    78
  • Joined

  • Last visited

Everything posted by mcerk

  1. ok, then image object has to be disposed. What about code below. When I have a function declared as image. Do I have to dispose this function somehow or what??? tx 'the code dim img as image img = GetImage(someparameters) picturebox.image = img img.dispose 'getimage function Private Function GetImage(someparameters) as Image dim img as image img = image.fromfile(someparameters) GetImage = img img.dispose End Function
  2. Hi. I'm drawing with GDI+ a lot in my app. I have a lot of memory leaks. I thought, that this is becouse I do not dispose graphic objects. So, which gr. objects do I need to dispose? Is there a list anywhere? like: pen ?, brush?, image?, ...??? tx, matej
  3. I'd like to measure how many memory does my app take. How can I measure that? I know I can look at the task manager, but I'd like to measure it every 1 hour and put that value into database. So I'd like to measure it with .NET (it can be VS 2003 or VS 2005) tx, Matej
  4. Hi. I'd like to download file from internet. I'd like to download specific picture. I have a lot of problems, becouse file doesnt get downloaded each time. I'm using this procedure and in 5 of 10 shots it fails. please help 'download image Try My.Computer.Network.DownloadFile(urlPath, myFile, "", "", False, 10000000, True) sql.Insert_Log(clsSQLfunctions.ErrorTypes.Importance4, 1, "Downloaded: ", urlPath) Img = Image.FromFile(myFile) DownloadImage = True Catch ex As Exception DownloadImage = False sql.Insert_Log(clsSQLfunctions.ErrorTypes.Importance1, 1, "Error: Can't download (or rewrite) file", "DownloadImage #2 " & urlPath & " " & myFile) End Try
  5. directory browsing is enabled, look at the link
  6. Hi. I'm getting some pictures from internet (through http protokol). I'd like to get the time, when they were put on the server, or (even better) when were they created. I cant read file creation property when pictures are allready downloaded, becouse this date/time represents file creation time on my disk (time of download). IE can do it, so I'm sure VB can allso For ex. look url: http://prognoza.hr/aladinHR/
  7. tx a lot. it works
  8. Hi, I want to create a windows service with a timer. So one event will fire on every while. I'm using Visual Studio 05 But it doesn't work. The code is fine, becouse it works in normal win app. with sql.Insert_Log I just inser a log into db, so I can see that service is working. All I get in my log file is 'Start Service' and 'Stop service'. The timer tick event never starts. what is wrong? Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. 'set connstring sql.ConnectionString = sConn pp.sql = sql sql.Insert_Log(clsSQLfunctions.ErrorTypes.Importance1, 1, "Start Service", "") 'zagon timerja Timer1.Interval = 10 '* 3600 Timer1.Enabled = True End Sub Protected Overrides Sub OnStop() ' Add code here to perform any tear-down necessary to stop your service. Timer1.Enabled = False sql.Insert_Log(clsSQLfunctions.ErrorTypes.Importance1, 1, "Stop Service", "") End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick sql.Insert_Log(clsSQLfunctions.ErrorTypes.Importance1, 1, "Timer Tick", "") 'pp.PreparePictures() End Sub
  9. Hi. I'd like to manipulate with some image files with windows service application. If I start a windows project in Visual Studio, then Images and Bitmaps objects are not supported. Why? Why windows service shouldn't operate with System.Drawing classes??? Here are few sample fucntions, that doesn't work. Can U help me? Private Function Crop(ByVal img As Image, ByVal Img_X As Integer, ByVal Img_Y As Integer, ByVal Img_width As Integer, ByVal Img_height As Integer) As Image 'crop image Dim bmpImage As Bitmap = New Bitmap(img) Dim recCrop As Rectangle = New Rectangle(Img_X, Img_Y, Img_width, Img_height) Dim bmpCrop As Bitmap = New Bitmap(recCrop.Width, recCrop.Height, bmpImage.PixelFormat) Dim gphCrop As Graphics = Graphics.FromImage(bmpCrop) 'pustimo na vrhu plac za text Dim recDest As Rectangle = New Rectangle(0, 15, Img_width, Img_height + 15) gphCrop.Clear(Color.White) gphCrop.DrawImage(bmpImage, recDest, recCrop.X, recCrop.Y, recCrop.Width, recCrop.Height, GraphicsUnit.Pixel) Return bmpCrop End Function Private Function AddText(ByVal img As Image, ByVal Text As String) As Image 'add text Dim bmp As Bitmap = New Bitmap(img) Dim gphText As Graphics = Graphics.FromImage(bmp) Dim f As Font = New Font("Arial", 5, FontStyle.Italic) gphText.DrawString(Text, f, Brushes.Black, New Point(1, 1)) Return bmp End Function Private Function ResizeImage(ByVal img As Image, ByVal Img_Width As Integer, ByVal Img_Height As Integer) As Image 'resize Dim imgCallBack As System.Drawing.Image.GetThumbnailImageAbort = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf CallBackMethod) Dim imgThumbnail As System.Drawing.Image = img.GetThumbnailImage(Img_Width, Img_Height, imgCallBack, IntPtr.Zero) Return imgThumbnail End Function
  10. I know. So. Does anyone know some other method, to open this file? Becouse, as I said, I can not change the file format. :(
  11. ACDSee 8.0 opens it correctly ...
  12. Hi. This is strange. I can not open this image in visual studio. I'd like to manipulate with this image in run time, therefore I need to open image and load it into variable type Image. 'here I load an image from file dim img as Image = Image.FromFile(myFile) 'image is not loaded completely. Size of image is correct, but content is white. There is no image displayed!!!???!??!??! Can anyone figure out, why? If I convert Image using some other graphics program, and then try to open it in VS it works. But this will be automatic task, so I can't change source image format. PS: I've attached source image, so you guys can play with. PSS: image format is GIF, 585x630x32 tx matej
  13. I want to play sound files (.wav) on ppc. How can I do it on compactframework using VB.NET?
  14. I have two tables in dataset: PhoneBill -phonenumber -cost -duration ..... and PhoneBook -phonenumber -surname_name All I want to do, is actually a RIGHT JOIN between tables on 'phonenumber field'. I Can Not Use SQL server or anything else, so let's try to do this on 'dataset level'. I want to join this tables. So in Datagrid I want to display: -phonenumber -surename_name (if exists in phonebook) -duration -cost .... 'I made a relation between tables in dataset ds.Relations.Add("PhoneBill_PhoneBook", ds.Tables("PhoneBill").Columns("phonenumber"), ds.Tables("phonebook").Columns("phonenumber"), False) 'the problem is, that I do not know how to display wanted data in one row: Me.DataGrid1.DataSource = ds.Tables("MainData") 'in this case there are displayed all records from phonebill, but there the column 'name_surname' is displayed lower as a child table. tx in advance :rolleyes: matej
  15. My VB.NET application has a startup object Sub_Main. So. Default form is Module (With Sub Main procedure) The problem occures when I press Alt-Tab. There is displayed only Default icon. (I have set default project icon and all form's icons to my custom icon) tx in advance Matej
  16. thanx Private _doc As New XmlDocument _doc.ChildNodes(1).ChildNodes(0).InnerText = TextBox1.Text _doc.ChildNodes(1).ChildNodes(1).InnerText = TextBox2.Text _doc.ChildNodes(1).ChildNodes(2).InnerText = TextBox3.Text _doc.Save(Application.StartupPath & "\test.xml")
  17. Hi I have an XM in this format: <?xml version="1.0" encoding="utf-8" ?> <Page> <mj>Value1</mj> <uv>Value2</uv> <pa>Value3</pa> </Page> How can I edit this values? tx in advance. Matej
  18. OK, I'd like to Encrypt pictures. I believe that I can Encrypt using the code below. Of couse I can use any other code (if you can reach the same objective). Private Shared Sub EncryptData(inName As String, outName As String, _ tdesKey() As Byte, tdesIV() As Byte) 'Create the file streams to handle the input and output files. Dim fin As New FileStream(inName, FileMode.Open, FileAccess.Read) Dim fout As New FileStream(outName, FileMode.OpenOrCreate, _ FileAccess.Write) fout.SetLength(0) 'Create variables to help with read and write. Dim bin(100) As Byte 'This is intermediate storage for the encryption. Dim rdlen As Long = 0 'This is the total number of bytes written. Dim totlen As Long = fin.Length 'This is the total length of the input file. Dim len As Integer 'This is the number of bytes to be written at a time. Dim tdes As New TripleDESCryptoServiceProvider() Dim encStream As New CryptoStream(fout, _ tdes.CreateEncryptor(tdesKey, tdesIV), CryptoStreamMode.Write) Console.WriteLine("Encrypting...") 'Read from the input file, then encrypt and write to the output file. While rdlen < totlen len = fin.Read(bin, 0, 100) encStream.Write(bin, 0, len) rdlen = rdlen + len Console.WriteLine("{0} bytes processed", rdlen) End While encStream.Close() End Sub But How Can I decrypt and then show picture in a picturebox? I do not want to save dectypted file on disk, I'd only like to have it in RAM. tx matej
  19. Yes, I believed that drawing rectangle is maybe my only choice. But I have to draw a line. So I could draw very thin rectangle - I'll have some trouble with rotation, but I can firuge it out. brrrrrr.... I'll have to take a pen and paper into my hands and do some mathematics...
  20. Hi. How can I draw a line with linear gradient. Let's say to start at color.Red and end with color.Blue tx, matej
  21. Ok. I have a question. Is there any simple way to draw graphs in .NET? I have 1000 points (X and Y coordinates). I could of course draw 1000 lines between them. But there wouldn't be a smooth line. Is there possible to create a graph (maybe using exell functions)? tx matej
  22. picMap.Refresh
  23. Hi. I'm drawing on picturebox with backgroudn image. How can I clear graphics? I want that Background image is still shown. Dim G As Graphics = Me.picMap.CreateGraphics() 'coordinate sistem Dim TranslateDx As Long = -375050 Dim TranslateDy As Long = -194050 Dim ScaleDx As Single = Me.picMap.Width / (624250 - 375050) Dim ScaleDy As Single = Me.picMap.Height / (29850 - 194050) G.TranslateTransform(TranslateDx, TranslateDy, MatrixOrder.Append) G.ScaleTransform(ScaleDx, ScaleDy, MatrixOrder.Append) 'here I want to clear graphics to draw new line 'draw line PenStojisce.EndCap = LineCap.Triangle G.DrawLine(PenStojisce, Me.BindingContext(ds.Tables(0)).Current("X1"), Me.BindingContext(ds.Tables(0)).Current("Y1"), Me.BindingContext(ds.Tables(0)).Current("X2"), Me.BindingContext(ds.Tables(0)).Current("Y2"))
  24. OK, I'd like to create a Inno Setup script on the fly. So, what I need is to run a command like this: Dim Quote As String = Microsoft.VisualBasic.ChrW(34) Dim strFile As String = "iscc.exe" Dim Arguments As String = Quote & "myproject.iss" & Quote & " /Q" System.Diagnostics.Process.Start(strFile, Arguments) '/// launch the chm file to view it. but the problem is, that cmd window is shown. How can I silently execute it and read it's exit code? 'Valid options are: "/O" to specify an output path '(overriding any OutputDir setting in the script), '"/F" to specify an output filename (overriding any OutputBaseFilename 'setting in the script), "/Q" for quiet compile (print only error messages), 'and "/?" to show a help screen. 'Example: ' iscc /Q /O"My Output" /F"MyProgram-1.0" "c:\isetup\samples\my script.iss" ' ISCC will return an exit code of 0 if the compile was successful, 1 if the 'command line parameters were invalid or an internal error occurred, 'or 2 if the compile failed. tx
  25. Hi' I'd like to add a tooltip to MenuItem (member of ContextMenu) how can I do that? This code does not work (Value of type 'System.Windows.Forms.MenuItem' cannot be converted to 'System.Windows.Forms.Control'): Dim m As MenuItem = Me.ContextMenu1.MenuItems(0) Me.ToolTip1.SetToolTip(m, "blablabla") tx, matej
×
×
  • Create New...