|
|
hai,
i want to draw a backgroun image on a resizable form. i tried Paint Form_Paint event as follows
e.Graphics.DrawImage( hImage , 0 , 0 , Me.width , Me.height )
this draws only at the updated portion of the window and the previous drawing remains the same, hwo can i draw image on entire window
|
|
|
|
|
before drawing clear the graphics
Me.CreateGraphics.Clear(Me.BackColor)
then redraw the background image
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
thanks its works !
but i think i should use Me.CreateGraphics.DrawImage(h, 0, 0, Me.Width, Me.Height) instead of PaintEventArgs
|
|
|
|
|
nitin3 wrote: but i think i should use Me.CreateGraphics.DrawImage(h, 0, 0, Me.Width, Me.Height) instead of PaintEventArgs
No, you should not.
You should use the Graphics object that is sent in the PaintEventArgs . It's already created for you, so there is no reason to create another Graphics object. Also, it's cropped to the control that is to be redrawn, so that you don't draw outside the control by mistake.
Further more, if you use Me.CreateGraphics.DrawImage(...) then you don't get any reference to the created Graphics object, so there is no way that you can dispose it properly, which you have to do if you create Graphics objects yourself.
---
single minded; short sighted; long gone;
|
|
|
|
|
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Me.CreateGraphics.Clear(Me.BackColor)
e.Graphics.DrawImage(hImg , 0, 0, Me.Width, Me.Height)
End Sub
when i using this code the image drawn on the stretched and the other portion of window fill with backcolor, plz tel me how to correct this code.
|
|
|
|
|
try using
e.graphics.clear(me.backcolor) instead of the me.create...
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
its not working
the below code works for me but Guffa told me that i should use PaintEventArs. If i using the following method to paint i should write the same code on Form_Resize.
is there any another method to show a stretched background image ???
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Me.CreateGraphics.Clear(Me.BackColor)
Me.Graphics.DrawImage(hImg , 0, 0, Me.Width, Me.Height)
End Sub
|
|
|
|
|
nitin3 wrote: Me.CreateGraphics.Clear(Me.BackColor)
Use e.Graphics instead of Me.CreateGraphics.
---
single minded; short sighted; long gone;
|
|
|
|
|
I think I have an alternative way to do this which is more elegant
In the constructor of your class you can add this line:
SetStyle(ControlStyles.ResizeRedraw, true)
then from that point windows will stop sending small redraw to part of the control and assume the whole control needs to be repainted when resized.
|
|
|
|
|
thanks, this solved my problem !!
|
|
|
|
|
Hi all,
I need to show the total of a column in datagridview. Actually I am not getting the event, as we have Item DataBound Event in ASP.NET is there any event in VB.NET also?
Please help me.
Thanks in advance.
|
|
|
|
|
MsgBox(DataGridView1.Columns.Count.ToString)
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
this will display the column count and I want the total of that column.
Ex:
Column1 Column2
12 14
10 15
-----------------------------
22 29
Please help me.
|
|
|
|
|
sorry, i can not get u properly in Previous message.
i m not sure about existance of any property of datagridview which is matched with your requirement.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Hi don't know if this will help but this is how I add up a column and show in a textbox.
Good luck
For Each NewTotal As DataRow In Me.HorsesDataSet.CHARGES.Rows
If NewTotal("TOTALCOSTFORSERVICES") Is System.Convert.DBNull Then
Else
Nos = Nos + CDbl(NewTotal("TOTALCOSTFORSERVICES"))
End If
Next
txtbxOverallCost.Text = Format(Nos, "£#,##0.00")
Nala
|
|
|
|
|
Dear friends,
I am getting gdi+ error when using .colordepth in any format (1L in int32, long or just 1L).
what to do?
Heres the code sample.
The error is on the same line.
But taking depth at 24L its working.
I wan't output with 1L only.
Thanks,
ThisEncoderParameters.Param(0) = New EncoderParameter(Encoder.SaveFlag, CType(EncoderValue.MultiFrame, Long))<br />
ThisEncoderParameters.Param(1) = New EncoderParameter(Encoder.ColorDepth, CType(1L, Int32))
-- modified at 6:09 Monday 3rd September, 2007
|
|
|
|
|
This depends on how you're using this, but it looks like the ColorDepth parameter only works with GIF and TIFF files.
|
|
|
|
|
I have been trying this with tif images only.
But don't know why it don't take depth less then 24L
|
|
|
|
|
From what I've been reading, GDI doesn't support 1 bit color depth.
|
|
|
|
|
Hello All,
In my application i have to change child form text and label's visible property to false based on some condition like:
In my application MDI form is a startup screen and written the following code
if bvar = false then
dim frm as new frmchild
frm.label1.visible=false
frm.text="Hello"
end if
Presently i have written it in module because it has to be included in either a class or module as per requirement.
But, whenever i execute my application, the label still remains visible and also form text remains the same.
I am using dot net 2003.
anyone who knows, Please help at the earliest how properties can be changed at runtime.
Please provide some code if possible.
Thanks .
|
|
|
|
|
Pass the Form object to module when you call the Module.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
I have to change multiple child forms label property with a single call.
is it possible.
I am calling the procedure in MDI load event. In the single procedure,
I have created instances of multiple child forms.
Am i doing nothing wrong.
the same code executes in vb.net 2005 , so how it can be done in vb.net 2003
|
|
|
|
|
Hi you need to hold the all object of the form. So
Create the all form object out of the mdi form load method and call module and pass each form object to the module.
Or if got any error messages then post here.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Hello All,
Well i am working with collections in the project.
I have set the datasource property of the datagrid to a collection (I am not using dataset just the collection).
I am unable to format the datagrid using the tablestyles.
Would anyone please help me in formating the datagrid (using tablestyles) when the datasource property is set to a collection.
Thanks in advance,
P.S - I am unable to set the mappingname property in the tablestyle to collection.
if you send a mail at gokhale.i1@gmail.com in response to this query it would be better...
|
|
|
|