|
Use the SetPixel method of the Bitmap class.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
ok, i have use the setpixel to draw one pixel now, but how about the next pixel, it will be replacing the color that have been draw before,
here my sample code for button click event:
Dim bmp As New Bitmap(PictureBox3.Width, PictureBox3.Height)
Dim gr As Graphics = Graphics.FromImage(bmp)
Dim A As Color
Dim i, j As Integer
i = 0
j = 0
Dim n As Integer
For n = 0 To ListBox1.Items.Count - 1
If ListBox1.Items(n) = "A" Then
A = Color.Orange
ElseIf ListBox1.Items(n) = "R" Then
A = Color.Red
ElseIf ListBox1.Items(n) = "G" Then
A = Color.Lime
Else
A = Color.Black
End If
bmp = New Bitmap(100, 100, gr)
bmp.SetPixel(i, j, A)
i = i + 1
j = j + 1
'gr.DrawImage(bmp, 10, 10)
Next
bmp.Save("C:\bmp.bmp")
how can i store the drawing untill it complete all process and then show them..
|
|
|
|
|
You are creating a new Bitmap object for every iteration in the loop, throwing away the previous bitmap, so only the last pixel will be present in the last bitmap. You should create only one Bitmap object.
And remember to Dispose all the Bitmap and Graphics objects that you create when you are done with them.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
In addition to the response you got, if you have a big bitmap, you should read my image processing articles for more efficient ways to set a LOT of pixels.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi
Is there a possibility to specify for each webbrowser control an extra folder for the belonging temporary internet files ??
By now it is always the same folder as IE uses but at least i wanna store the data in an extra subfolder
Thx
|
|
|
|
|
No, there isn't. If you change the temporary folder, it's changed for all instances of IE and the Web Browser control.
|
|
|
|
|
|
help is a useless subject line.
Yes, of course you can. C# and VB.NET target the same runtime, so there's no reason you can't. You can even compile the control as a C# dll and import/use it in VB projects, or buy libraries that will convert it for you.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
ill try a better subject line next time lol
im only just starting out programming i have written basic things before but that was on quick basic and vb4 when i was about 9-10 im 19 now and the way things are done with these programs seems completely different anyway cheers for information
regards iain
|
|
|
|
|
Yeah, VB.NEt is a whole new language compared to VB6, etc. Much better, tho.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Christian Graus wrote: Much better, tho.
I agree. People need to become more aware of it, rather than smacking on it.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Use a more meaningful subject line, rather than just help.
It shouldn't be that hard to rewrite in vb.net, but why?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
good day to everyone!
can anyone help me on freezing applications or disable opening of other applications other than the system that i created using VB? can VB do such a thing?
thanks!
|
|
|
|
|
No - VB6 is rubbish. It can barely do anything.
Seriously, you can't really do it, you COULD write an app that is a service, watches for apps to start and kills them, but it would be easy to defeat, just stop it.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
This is best done using Group Policies, not your code. There's no way for your code to stop the loader from loading an arbitrary application.
|
|
|
|
|
Recommend you move away from VB6, it has been dead for three years now...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi,
i have created an application in which i have used third party dll for locking desktop.I have created this application from windows administrator account and everything is working fine from this account.Now i have created a new windows user account which does not have admin's rights and when i am running my application from this account, third party dll for locking desktop does not work.plz give me solution for this.
Thank you.
coolsatty
|
|
|
|
|
I suspect you need admin rights to lock the desktop, but you would be better off contacting the dll vendor to check this.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i hav three setup file for the same application.two setup file for main installation and the other to indicate which one to install.when installation will start i want to fire the setup file which will indicate the two types of installation.how can i call first, that indicator setup file?
pls help.
modified on Tuesday, July 8, 2008 7:29 AM
|
|
|
|
|
Hi friends,
We use SAP dll's (librfc32.dll v6405.5.162.5282, librfc32u.dll v6405.5.162.5281, ...) to open a connection to SAP server, but if server can't response us we used to wait for a while (60 sec).
Can we decrease this connection (logon) timeout to a lower constant (10 sec).
Does anyone know how to set this logon timeout?
Thanks for your help.
|
|
|
|
|
You'll probably have better luck finding an answer to questions related to SAP products here[^]
If you have access to the SAP Service Marketplace you should be able to request a user ID for the developer forums.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hello
I have the following code that draws a rectangle in panel. Now I want that when I click a button I draw the rectangle in the panel. Can any one help pls.
Thank you
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Dim g As Graphics = e.Graphics
Dim rect As New Rectangle(50, 30, 100, 100)
Dim lBrush As New LinearGradientBrush(rect, Color.Red, Color.Yellow, LinearGradientMode.BackwardDiagonal)
g.FillRectangle(lBrush, rect)
End Sub
|
|
|
|
|
Call Panel1.Invalidate() in the click event of the button
|
|
|
|
|
You may use a Boolean variable and set its value on button click, in paint event of panel keep the same code however just check for value of this Boolean variable before drawing the rectangle.
Such as –
----------------------------
Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
If flag=True then
Dim g As Graphics = e.Graphics
Dim rect As New Rectangle(50, 30, 100, 100)
Dim lBrush As New LinearGradientBrush(rect, Color.Red, Color.Yellow, LinearGradientMode.BackwardDiagonal)
g.FillRectangle(lBrush, rect)
End If
End Sub
-------------------------
In case if you are going to draw more than just one rectangle in that panel, you may use an array of rectangle to draw multiple items on panel.
-Dave.
------------------------------------
http://www.componentone.com
------------------------------------
|
|
|
|
|
I am modifying a driver (DLL) that is written in VB6.
One of the modifications requires me to do a checksum check on all received data.
Here is the CRC Calculation Specification[^] which is unfortunately Greek to me (and seems to CP members also from the response I've been getting ). Mostly because my C coding knowledge is almost NULL and my ASM is very rusted.
The resulting CRC value is a string of 4 hexadecimals e.g. "1BF2".
How should I go about doing this in VB6?
Kind Regards
modified on Tuesday, July 8, 2008 9:21 AM
|
|
|
|