|
Member 4196521 wrote: Is VB (and GDI+) a bad choice for this type of work?
Not even remotely. It's the most trivial way I can see of doing it in a meaningful language. You just handle the paint event of your form, and you're passed a Graphics object. This object has methods for drawing shapes onto the form, using other objects like Brushes and Pens.
I think your best bet is to look at the MSDN for help on the Graphics object, I suspect that once you know that's where to look, you'll find that the documentation is going to lead you from there.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Much obliged, Christian. Fears assuaged and whole bottle of eye drops at the ready. Once more unto the breach..
|
|
|
|
|
By all means, ask more specific questions if you still get stuck, but I think that's the boost you needed to get you on your way.
One thing, if you create any brushes, etc, they need to be disposed of, you call Dispose() on them, after using them. Using a system brush like Brushes.Black, does not have this requirement. Nor should you Dispose of the graphics object passed to you on the event args, although if you ever create your own, you should dispose of them, too.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Uncanny timing, I had just read about 'dispose' on MSDN. Too soon to tell if I will be using a brush or coordinate points-to-lines to create filled rectangles : {, which may be far more work but seems to offer easier translation from the resultant calculations to be performed in determining spacing, typically to thousandths of inches to reduce accumulated error. The graphics don't require such precision, merely visual feedback, but no sense not using it if it's there I figure.
|
|
|
|
|
Hello, I need help!!!
I have my application in visual studio 2008 (originally 2003). I use Access datbase and Cristal report Viewer to preview my reports. When I'm in the preview of a report, my whole system slow down really bad.
I have my database optimized and indexed
Any ideas what I can be doing wrong? if the problem is CR or Access.
Thanks!
|
|
|
|
|
well their could be alot of reason one can guess only in my opinion you might are passing your whole tables to cr and might then will be filtering using your selection criteria which is making it slower
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Thanks for that fast answer.
The issuie is that the report shows up fast, but while the preview of the report (crviewer) is open the rest of the computers slow down, it sound to my like all the database were locked but not because it still working but slow.
|
|
|
|
|
try to use windows task manger and see which process is consuming more cpu and memory
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I'll try it whan I go to my client office.
In the mean time we found out that if they leave a preview of the any report open and minimize they continue working normally, if you don’t have a preview screen open your computer start slowing down…that’s weird!
|
|
|
|
|
Hi,
Is there a way that you can check the state of the left mouse button inside a timer routine? I have a mouseup event but sometimes it seems like it doesn't go into the routine when i let go of the button.
Thanks
|
|
|
|
|
If you are having a handler then it should be executed when mouse up happens. Can you cite a scenario when it does not fires?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I'm basically making my own slider.
Dim mouseheight As Integer
Dim slidepos As Integer
Dim handletop As Integer
Private Sub sliderhandle_mousedown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sliderhandle.MouseDown
handletop = sliderhandle.Top
If MouseButtons = Windows.Forms.MouseButtons.Left Then
SliderTimer.Enabled = True
End If
mouseheight = MousePosition.Y
End Sub
Private Sub sliderhandle_mouseup(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sliderhandle.MouseUp
SliderTimer.Enabled = False
handletop = sliderhandle.Top
End Sub
Private Sub SliderTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SliderTimer.Tick
slidepos = handletop + MousePosition.Y - mouseheight
If slidepos >= EmptyBar.Bottom - 15 Then
sliderhandle.Top = EmptyBar.Bottom - 15
ElseIf slidepos <= EmptyBar.Top Then
sliderhandle.Top = EmptyBar.Top
Else
sliderhandle.Top = slidepos
End If
endTimer:
End Sub
End Class
So when i have the mouse down it is going through the timer routine and when i let go it should make sliderTimer.enabled = false
It works most of the time except for when i click and move the slider for a split second. Then what happens is it follows my mouse even though i do not have the button clicked. So i was thinking if i could check the mouse button state then i could force it to disable the timer.
|
|
|
|
|
Hi,
Control.MouseButtons contains the instantaneous value you want.
if ((Control.MouseButtons & MouseButtons.Left)!=0) ... would be C# code, VB must be similar.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Sorry if this has been answered, but I couldn't find it.
I'm in VS2005 but using win7 as my os. There are problems resizing forms (strange flickers) and the new win7 "tricks" (for instance, dragging the window off the top to maximize) don't work. Do I need to recompile with VS2008 or is there another solution?
Thanks
|
|
|
|
|
Works for me just fine on Win7 Ultimate
Tosch
|
|
|
|
|
OK, thanks, I see that a simple form does work OK. So I have done something to my form that stops it from working. Any ideas?
Thanks again
|
|
|
|
|
Lots of code in the Form.Resize handler?
I are Troll
|
|
|
|
|
Nice guess, but no -- I don't even have the handler instantiated.
I tested the obvious stuff -- autoscalemode, autosize, etc, but it's not those either that I can tell.
|
|
|
|
|
OK, it's just the strange flashing that is what I think is a bug that only happens in Win7. Can anyone replicate this?
Add a horizontal splitcontainer to a form. Then run the program and resize the form from the lower right corner of the form. The form will flash larger then move back to it's correct size.
Thanks
|
|
|
|
|
Have you played with the control property DoubleBuffered? does that make a difference? Also there are BeginUpdate and EndUpdate methods that can be used when populating controls to prevent/reduce flicker.
modified on Friday, September 11, 2009 4:00 PM
|
|
|
|
|
It's not really flicker, it's erroneous drawing of the form on resize. You can see what I mean here:
http://www.cstrader.com/untitled/untitled.htm
Althouh it doesn't look like it on the video, the mouse that is dragging is actually in the corner of of the form
As the form resizes it snsps big, then snaps back to normal size.
The form has only a full-docked splitcontainer on it.
Only happens in win7.
|
|
|
|
|
Is there a best way to report this issue to Microsoft? I simply cannot make it stop and it occurs on a form with only one control and no code.
Thank you.
|
|
|
|
|
HEllo To all
i want to thank every one that has help me out on this message board every one has been good here and i have been getting grate help
Thank You all
i got a other question
i am opening a excel template in my program but i am trying to make the file path shorter
xlWorkBook = xlApp.Workbooks.Open("C:\Documents and Settings\Dell Laptop\My Documents\Visual Studio 2008\Projects\Timer\Timer\Templates\log.xls")
Say the other computer is not called Dell Laptop its not going to work
i want it to be with the program no mater ware the program is it will save it in its template forlder
i have tryed this
xlWorkBook = xlApp.Workbooks.Open("\Templates\log.xls")
this did not work
anyone have any ideas ???
Thanks
|
|
|
|
|
Just for clarity, are you trying to open an existing document, or are you trying to create and open a new document?
If you need to open an existing document, which you have not created yourself earlier on in your application, and the user can save the document anywhere on his computer, the best way is to use an OpenFileDialog .
If you created the document yourself earlier on in your application, just store it to a shorter path to begin with. In that case you could just use xlWorkBook = xlApp.Workbooks.Open("log.xls")
My advice is free, and you may get what you paid for.
|
|
|
|
|
My program will do everything on its own
it will open the file log.xls from the template folder add data to it and then save the file to the log folder
by just putting the file name and no path it ends up in my documents i want it to be in the same folder as my program i added the folder in the solution exploer
Thanks
|
|
|
|