|
Thanks for your answer. This is a good way around. but by this way, i cannot add object of mytest as a Control in my form.
|
|
|
|
|
Hi all,
I have a variable(String) that i want to store it in resources file so that i can retrieve it's value in coding process. But unfortunately, in coding process, i need to change it's value.
Ex : I have a variable MyName that is stored in resources
+ begin : MyName = "FirstForm"
+ after changing : MyName = "SecondForm"
How could i change MyName's value from "FirstForm" to "SecondForm" ?
|
|
|
|
|
Resources are Read Only. You'll have to save this information somewhere else.
|
|
|
|
|
Hallo,
I wrote this code, it works and it magnify "MyPicture" 8 times to the Form1.
Now my question:
Is there a possibility to use the bitmap of a PictureBox for the Destination of
StretchBlt, or copy the destination to a PictureBox?
Thanks for answerig, Hans-Christian
Imports System.Runtime.InteropServices<br />
<br />
Public Class Form1<br />
Dim srcImage As New Bitmap("MyPicture.bmp", True)<br />
Dim Graph As Graphics = Me.CreateGraphics<br />
Dim desHdc As IntPtr = Graph.GetHdc()<br />
<br />
Dim srcHdc As IntPtr = CreateCompatibleDC(IntPtr.Zero)<br />
Dim hBitmapSrc As IntPtr = srcImage.GetHbitmap()<br />
<br />
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
<br />
SelectObject(srcHdc, hBitmapSrc)<br />
SetStretchBltMode(desHdc, 13369376)<br />
StretchBlt(desHdc, 0, 0, 4096, 4096, _<br />
srcHdc, 0, 0, 512, 512, _<br />
TernaryRasterOperations.SRCCOPY)<br />
<br />
End Sub
|
|
|
|
|
Beginner_HC wrote: Public Class Form1
Dim srcImage As New Bitmap("MyPicture.bmp", True)
Dim Graph As Graphics = Me.CreateGraphics
Dim desHdc As IntPtr = Graph.GetHdc()
Dim srcHdc As IntPtr = CreateCompatibleDC(IntPtr.Zero)
Dim hBitmapSrc As IntPtr = srcImage.GetHbitmap()
This is a REALLY bad idea. Make this stuff class-scoped will cause you severe problems later on. You should ALWAYS Create, Use, then Destroy your graphics object only when you need them and only for as long as you need them. Caching one like this doesn't do you any good because some operations will only be commited when the Graphics object is finally destroyed.
What are you trying to do with this code again? You OP wasn't very clear about what your doing with this. What's the ultimate goal here?
|
|
|
|
|
Hi Dave,
what I am actually like to realise is to magnify a Picture 8 times,
every pixel should become a small rectangle.
And I like to hafe this magnification as a bitmap that can be shown in a PictureBox,
becaus than I can scroll the form of the PictureBox without loosing the Picture when it is coverd
by a other Form.
Regards,
Hans-Christian
|
|
|
|
|
For a beginner, you're tackling a pretty complex subject with Win32/GDI...
OK... It's a real pain, but here goes. Of course, you have to have the Declares for StretchBlt, SelectObject, DeleteObject, and DeleteDC created to use this...
Private Sub CreateMagnifiedImage(ByVal MagFactor As Integer, ByVal srcBitmap As Bitmap) As Bitmap
If srcBitmap IsNot Nothing Then
Dim magSize As New Size(srcBitmap.Width * MagFactor, srcBitmap.Height * MagFactor)
Dim magBitmap As New Bitmap(magSize.Width, magSize.Height)
Dim g As Graphics = Graphics.FromImage(magBitmap)
DrawMagnifiedImage(g, srcBitmap, magSize)
g.Dispose()
End If
End Sub
' This is the code Ive used before to magnifiy an image...
Private Sub DrawMagnifiedImage(ByVal gTarget As Graphics, ByVal srcBitmap As Bitmap, ByVal newSize As Size)
Dim hBmp as IntPtr = srcBitmap.GetHbitmap()
Dim hdcTarget As IntPtr = gTarget.GetHdc()
Dim hdcSource As IntPtr = CreateCompatibleDC(hdcTarget)
Dim hOrig As IntPtr = SelectObject(hdcSrc, hBmp)
StretchBlt(hdcTarget, 0, 0, newSize.Width, newSize.Height, hdcSource, 0, 0, srcBitmap.Wdith, srcBitmap.Height, TernaryRasterOperations.SRCCOPY)
SelectObject(hdcSource, hOrig)
DeleteObject(hBmp)
DeleteDC(hdcSource)
gTarget.Release(hdcTarget)
End Sub
|
|
|
|
|
Hi Dave,
Thank you! This was it was I am looking for, since weeks!
Hans-Christian
|
|
|
|
|
can anybody let me the oops concept in .net with an example. how to use polymorphism, abstract class, encapsulation in our application.
thanks for your help.
Rafeeque
|
|
|
|
|
With "an example"?? That's simply not possible. OOP concepts take entire books to cover. One or two examples in a forum environment simply is not going to be enough to cover the huge scope of your question. About the only suggest we can make is to get a compule of books. Search Amazon for "OOP VB.NET" or "VB.NET Beginner" and you'll come up with a bunch of them.
|
|
|
|
|
Sounds more like general homework questions to me.
__________________
Bob is my homeboy.
|
|
|
|
|
Doesn't change my answer!
|
|
|
|
|
Dave Kreskowiak wrote: Doesn't change my answer!
Yep. Homework or not, same answer
|
|
|
|
|
I wasn't disagreeing with your answer!
__________________
Bob is my homeboy.
|
|
|
|
|
i know its not simple to explain. give some brief notes or good links for encapsulation, polymorphism, abstract class with some coding example. and how it will use in our application.??
thanks for your help
|
|
|
|
|
You're still asking for WAY TOO MUCH information for a forum environment. Don't make me repeat myself.
|
|
|
|
|
Dear Mr. Dave Kreskowiak
Microsoft MVP Visual Developer
Thanks for your help. If you don't want to give me a link, tell me clearly. why r u dropping such kind of hurt message. Anyhow one of my good friend given the following link
http://www.c-sharpcorner.com/UploadFile/eecabral/OOPSand.NET211102005075520AM/OOPSand.NET2.aspx
Thanks for your co-operation.
Regards
Rafeeque Ahmed
|
|
|
|
|
That article just scrathes the surface. There's far more to OOP than what's in that article.
|
|
|
|
|
i hv developed an application in vb.net its having more 50 forms. when i open the same in vs.net my pc become slow. when the application is running, the pc get slow. this application was developed for Electrical Company and having 10 different users to access their option. the database also having much more (means 2 lakhs) record under one table not in every tables. some its giving error 'time out expired' while retrieving datas from the table.
what is best way to develop an application. what is procedure. what are things to be careful while developing an application?????. for retrieving data im using sqldatapter and filling in dataset. after that im not closing the connection. i read from some vb.net help book that if you fill the tables in dataset, after its filled in dataset its closing the connection automatically. im using sqlcommand and executenonquery to store information to the table.
it's a memory problem, obviously i would need to figure why so much memory is being used. It could be a problem with my code or perhaps just a problem due to the amount of data im retrieving.
kindly help
Rafeeque ahmed
|
|
|
|
|
Rafeeque Ahmed wrote: what is best way to develop an application.
Entire books are written on this subject alone. There is really no way of answering your question because of it's broad scope.
Rafeeque Ahmed wrote: what is procedure.
Again, another book.
Rafeeque Ahmed wrote: what are things to be careful while developing an application?????.
And another...
Rafeeque Ahmed wrote: it's a memory problem, obviously
No, it's not. It a major design problem with your app. Since we know nothing of your application, what's it's purpose is, what the slow parts of the app are, the structure of your database, the amount of data you REALLY need to be retrieving, are you using the appropriate methods for manipulting the data, are your queries optimized for the data and operation in question, ..., on and on and on, ... There is really nothing we can answer here other than suggesting a design review of your database, then a complete code review to veryify that you're doing things in the most advantageous way possible.
|
|
|
|
|
Your application performance problem can be one or more of many things. I would re-look over the entire design and see where there are potential bottlenecks and address them.
Rafeeque Ahmed wrote: what is best way to develop an application. what is procedure. what are things to be careful while developing an application?????
Like Dave said, this would require entire books or full term university coursework to cover...I would look around at a few books or on the web...
|
|
|
|
|
Iam using Webbrowser control in VB6 for Reporting and Printing.
While printing it also prints IE Header and Footer.
I searched many times from the google. But i didnt get any relevant result also.
I need to disable the Header and Footer of Webbowser control using VB, not manually from the page setup of IE.
And also to diable the Keyboard events for the Webbrowser.
Its very urgent!!!!
Please guide me.
Thanks & Regards
Kumaran
|
|
|
|
|
Hello,
How can i load a textfile into a textbox?
i tried:
dim txt as string
FileOpen(...)
Input(1, txt)
textbox1.text = txt
FileClose(1)
when i try this, i only get the first line of the file and not the lines below. how can i open a complete textfile and load it's (complete!) text into a textbox?
thanks in advance,
--Zaegra--
|
|
|
|
|
FileName = App.path & "\TextFile.txt"
Open FileName For Input As 1
whole_file = Input$(LOF(1), #1)
Close 1
Text1.Text = whole_file
Note : if the file contains more than one line you have to set the textbox control to multiline is true and their scrolls.
Thanks & Regards
Kumaran
|
|
|
|
|
Thanks, I will check this out
|
|
|
|