|
You can't do this without making your own PropertyGrid control and ownerdrawing the whole grid. The BackColor property of the PropertyGrid doesn't support Transparent.
|
|
|
|
|
thanks for that dave,
speaking as a person who has never ever used VB's drawing commands
and as someone who had a play at the weekend and got nowhere -
how would I do that?
any tips, ideas, code???
thanks
Martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
You start with creating your own PropertyGrid class, inheriting from the existing class.
Public Class MyPropertyGrid
Inherits PropertyGrid
.
.
.
Then you override the OnPaint and/or OnPaintBackground methods and supply your own drawing code to draw everything you need.
If you haven't used the drawing methods, or even have a basic understanding of how painting works, you're going to find this a frustrating process. Google for "vb.net drawing" for lots of examples and articles.
|
|
|
|
|
hi,
I have tried
Public Class myProp
Inherits PropertyGrid
Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
MyBase.OnPaintBackground(pevent)
Dim g As Graphics = pevent.Graphics
Dim gradBrush As System.Drawing.Drawing2D.LinearGradientBrush
gradBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Me.Width, Me.Height), Color.Green, Color.Blue)
' g.FillRectangle(gradBrush, 0, 0, Me.Width, Me.Height)
g.FillRectangle(gradBrush, pevent.ClipRectangle)
End Sub
Protected Overrides Sub OnPaint(ByVal pevent As PaintEventArgs)
MyBase.OnPaint(pevent)
Dim g As Graphics = pevent.Graphics
Dim gradBrush As System.Drawing.Drawing2D.LinearGradientBrush
gradBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Me.Width, Me.Height), Color.Green, Color.Blue)
' g.FillRectangle(gradBrush, 0, 0, Me.Width, Me.Height)
g.FillRectangle(gradBrush, pevent.ClipRectangle)
End Sub
but these dont seem to cover the area where the "view back color" paints. In actual fact they seem to paint on only one or two lines between the text time and the outer rim of the cocontroller area.
thanks
Martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
MartyK2007 wrote: Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
MyBase.OnPaintBackground(pevent)
Dim g As Graphics = pevent.Graphics
Dim gradBrush As System.Drawing.Drawing2D.LinearGradientBrush
gradBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Me.Width, Me.Height), Color.Green, Color.Blue)
' g.FillRectangle(gradBrush, 0, 0, Me.Width, Me.Height)
g.FillRectangle(gradBrush, pevent.ClipRectangle)
End Sub
First, you don't create your own Graphics object. You'll find it in the PaintEventArgs that you're getting when your code is called.
Dim g As Graphics = pevent.Graphics
Your next mistake is that if you want to REPLACE the background functionality, you don't call the base classes OnPaintBackground method. That will paint the background of the control just like you didn't even attempt to make your own version of it.
Third, the Graphics objects to DID create, you didn't Dispose of. This will, most assuredly, run your machine out of resources and your app will eventully crash with an OutOfMemoryException. On top of that, if you didn't create the object, like Graphics, you do NOT Dispose of it.
|
|
|
|
|
hey,
this was just sample code and not clean in any way.
Dave Kreskowiak wrote: Dim g As Graphics = pevent.Graphics
er if you look at the snippet - thats exactly what I do
MyBase.OnPaintBackground(pevent)
Dim g As Graphics = pevent.Graphics
Dave Kreskowiak wrote: REPLACE the background functionality
dont really want to replace them as overwrite on top of them thats why I ran this first.
Interestingly enough if I dont run the base classes then I get the same result.
Dave Kreskowiak wrote: Third, the Graphics objects to DID create, you didn't Dispose of
absolutely - this is a proof of concept , rather that a clean solution. Of course I will dispose of them properly when the solution happens.
My problem is that my color gradient only appears behind the propertygrid ( its its view back color area).Effectively this means a couple of lines at the top of the pG and a couple between the description block and the rest of the PG.
Try it and see what I mean.
I need to change the color of the view back color area to a gradient which is the bit where there is no properties left to display on the PG. Pick a class then use the category view and minimise ecah category - the coloured background at the bottom is what I am after.
thanks
Martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
MartyK2007 wrote: er if you look at the snippet - thats exactly what I do
MyBase.OnPaintBackground(pevent)
Dim g As Graphics = pevent.Graphics
My bad! I misread your code! :->
MartyK2007 wrote: dont really want to replace them as overwrite on top of them thats why I ran this first.
Interestingly enough if I dont run the base classes then I get the same result.
In order to get a transparent background, you have to replace the background drawing code. That's what your original post said you wanted.
MartyK2007 wrote: My problem is that my color gradient only appears behind the propertygrid ( its its view back color area).Effectively this means a couple of lines at the top of the pG and a couple between the description block and the rest of the PG.
This would mean that the background of each "cell" in the PG is painted by the foreground OnPaint method. You would have to replace the standard OnPaint drawing code with your own. This means that you have to paint the entire control yourself! Is it worth it?
|
|
|
|
|
Dave Kreskowiak wrote: replace the standard OnPaint drawing code with your own
hi,
I have added this to the properties grid onpaint event
Protected Overrides Sub OnPaint(ByVal pevent As PaintEventArgs)<br />
' MyBase.OnPaint(pevent)<br />
Dim g As Graphics = pevent.Graphics<br />
Dim gradBrush As System.Drawing.Drawing2D.LinearGradientBrush<br />
gradBrush = New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(Me.Width, Me.Height), Color.Green, Color.Blue)<br />
' g.FillRectangle(gradBrush, 0, 0, Me.Width, Me.Height)<br />
g.FillRectangle(gradBrush, pevent.ClipRectangle)<br />
<br />
End Sub
and I expected the control contents to vanish and be replaced with a gradient colour but nothing happened.
does this mean each cell has its own onpaint function??
if so how do I find them ???
Dave Kreskowiak wrote: Is it worth it?
yes if I can - I am trying to have a consistant look n feel in my gui app.
of course scroll bars seem to be a problem because I cant find where to cheange them either.
so yes any help would be appreciated
Martin
thanks
Martin
life is a bowl of cherries
go on take a byte
|
|
|
|
|
Hi, everyone!
Is there any way to use UNCs inside connection strings while using a standalone development PC?
I'm creating a database app using VB2005 and an Access MDB file. I'm currently using DRIVE:\Directory\File.mdb in my ConnectionString, but I'd like to use the \\Server\file.mdb option or even the PC's IP address (is this possible as well?).
In my Windows XP system, My Network Places won't show the shared files in my local PC unless I network it with another PC. Before, in older systems like Windows 98 and Windows 2000, even when the PC was not connected to another PC, the shared files could still be viewed in My Network Places and Network Neighborhood. Does anyone here know how to display the local shared files in Windows XP's My Network Places without having to have the PC connected to a network?
|
|
|
|
|
NekoGato wrote: Is there any way to use UNCs inside connection strings while using a standalone development PC?
It depends on the database you are connecting to. Some may allow it, others won't.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
is there a way to exceed the Richtextbox MaxLength of "2147483647"?,
may be there is a way to make it unlimited pls help.
|
|
|
|
|
You need to display more that 2 gigabytes of rich text at once!?! I think it sounds like you need to restructure other parts of your application rather than find ways around the very generous limitations in user interface controls.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
i agree with colin. but if you really want to do that... i think there's no way to extend the maxlength for richtextbox. instead make use of a label as what i know there's no specific maxlength for that.
|
|
|
|
|
hi All,
I m trying to connect crystal report to database(Access) but i have no idea plz give me code or any logic syntax.
thanks in advance.
Nikesh Yadav
CSS Infotech
Gurgaon,
Haryana(India).
|
|
|
|
|
hi,
use following code
Try<br />
Dim obj As report1 = New report1 'here report1 is Crystal Report<br />
Dim ds As New DataSet<br />
Dim da As OleDbDataAdapter<br />
Dim str As String<br />
str = "SELECT * from TableName"<br />
da = New OleDbDataAdapter(str, conn) 'here conn is connection object<br />
da.Fill(ds)<br />
<br />
<br />
obj.SetDataSource(ds.Tables(0))<br />
CrystalReportViewer1.ReportSource = obj<br />
Me.Show()<br />
Catch ex As Exception<br />
MsgBox(ex.Message, MsgBoxStyle.Information, "Report")<br />
End Try
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
i know this will works defintely. thanks for you help
but tell me one more thing you will write is code on which form i.e. on the form which contains crystal report viewer or on the crystalreport.cs Plz clear it.
|
|
|
|
|
hi,
code which i provide is for form which contain CrystalReportViewer.However you can write these code on any form(after some modification)
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
|
Hi! Everyone, I need help on loading myApp on startup, I made a Daily Time Record System. And I want to load/run this App after windows login password closes before the windows desktop display, I've already tried the registry keys in \CurrentVersion\Run but it's not what I want, also the startup folder doesn't work well.
Ex. After windows login, the screen goes black run my system... before loading any background apps...
thanks!!!
|
|
|
|
|
CurrentVersion\Run and startup folder is for windows explorer , windows explorer will start the programs in those locations after it is started by the system
You should write windows service
or , make your program as the Shell -> your program will replace the window explorer :
Key : "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Name: "Shell"
Value : "Your program's path"
|
|
|
|
|
there's a shell key already explorer.exe, svchost.exe value, do I need to delete this key and create a new one or just add my app's path? or create another shell key?
|
|
|
|
|
by default ,"Shell"="explorer.exe"
replace "explorer.exe" with "your program"
the logon process will start your program as Shell instead windows explorer after use log on
you have to start "explorer.exe" manually in your code
however , i don't think it is a good idea
|
|
|
|
|
Why what's wrong with your suggestion? Why is it not a good idea? Got a better Idea?
|
|
|
|
|
Hi all,
I intend to use a framework for my .net project in future, But framework for .net is rarely to find. If you know any framework for .net, please show me.
Thanks
|
|
|
|
|
What do you want ? The word 'framework' means all sorts of things. What are you looking for ? An ORM ? There are plenty of those.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|