|
Appdomain.AddPrivatePath("..\otheassemblies\")
I need the assembly loader to look into the otherassemblies directory that is directly above the BaseDirectory of the application, that is
c:\otherassemblies\
c:\myprogram\ <- BaseDirectory
The way I understand I need to tell the AppDomain about this privatepath using the AddPrivatePath method RELATIVE to the BaseDirectory account.
When I run the program it seems like both directories were accepted but the assembly prober doesn't even touch the \otherassemblies\ directory. That is privatepath is being ignored.
I also get the "Policy not being applied referenced."
Guillermo
|
|
|
|
|
The private path needs to be under the base directory.
|
|
|
|
|
Hi!
Im using a custom made doublebuffer transparent control over a mediaplayer-control. I would like to be able to pause the movie and then draw red marker rectangles on the transparent control. I would like to be able to see these rectangles while playing the movie. Everything works fine except for the last part, the rectangles dissappear as soon as I resume the movie. This is a test onPaint method in my transparent control:
protected override void OnPaint(PaintEventArgs e)
{
if(_backBuffer==null)
{
_backBuffer=new Bitmap(this.ClientSize.Width,this.ClientSize.Height);
}
Graphics g=Graphics.FromImage(_backBuffer);
//Copy the back buffer to the screen
e.Graphics.DrawImageUnscaled(_backBuffer,0,0);
// Get the graphics object
Graphics gfx = e.Graphics;
// Create a new pen that we shall use for drawing the line
Pen myPen = new Pen(Color.Red);
// Loop until the coordinates reach 250 (the lower right corner of the form)
for(int i = 0; i < 250; i = i + 50)
{
// Draw a 50x50 pixels rectangle
gfx.DrawRectangle(myPen, i, i, 50, 50);
}
g.Dispose();
gfx.Dispose();
}
Any tips?
THanks for your help
/Rickard
|
|
|
|
|
is the focus transfered to the movie when resuming try transControl.bringToFront()
orit is refreshed ?
ByMindOnlyYouCanDoIt
|
|
|
|
|
Hi!
Thanks for your answer, bringToFront() makes no difference. refresh() does, but only temporary, it seems like i need to refresh the transControl continuously while the movie is playing, and I dont like that solution, also it makes the rectangles flicker.
/Rickard
|
|
|
|
|
try to make the style of the control it self to this
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque,true);
try this,this would make the control paint will be only in the paint OVERRIDED method and the second flag makes its background is the control that is lying behind it as it won't paint its own packground so now u won't need to make tha back color transparent also
ByMindOnlyYouCanDoIt
|
|
|
|
|
No wont work either, unless im doing something wrong, here´s my entire transpanel class:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class TransPanel : Panel
{
private Bitmap _backBuffer;
public TransPanel()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque,true);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
return cp;
}
}
protected void InvalidateEx()
{
if(Parent==null)
return;
Rectangle rc=new Rectangle(this.Location,this.Size);
Parent.Invalidate(rc,true);
}
protected override void OnPaint(PaintEventArgs e)
{
if(_backBuffer==null)
{
_backBuffer=new Bitmap(this.ClientSize.Width,this.ClientSize.Height);
}
Graphics g=Graphics.FromImage(_backBuffer);
//Copy the back buffer to the screen
e.Graphics.DrawImageUnscaled(_backBuffer,0,0);
Font fnt = new Font("Verdana", 16);
Graphics gf = e.Graphics;
gf.DrawString("GDI+ World", fnt, new SolidBrush(Color.Red), 14,10);
g.Dispose();
//base.OnPaint (e); //optional but not recommended
}
protected override void OnPaintBackground(PaintEventArgs pevent)
{
//do not allow the background to be painted
}
protected override void OnSizeChanged(EventArgs e)
{
if(_backBuffer!=null)
{
_backBuffer.Dispose();
_backBuffer=null;
}
base.OnSizeChanged (e);
}
}
|
|
|
|
|
The last thing that you can try is to make another thread to the control to draw in and don't make that in the paint method and use thread timers to make it infinite or as u wish u can make it as the lenght of the vedio in this method u cac write
private void drawingMethod(object o)
{
//make this call at all the first
this.BringToFront();
//and then call it agai and again (but in a separate thread)//the timer will make this separate thread for u or u can make an instance of the thread class ex. Thread urThread = new Thread(new ThreadStart(medothname));
}
ByMindOnlyYouCanDoIt
|
|
|
|
|
It would seem that the Media Player is overwriting your boxes on top of it. This would be because the video that Media Player paints is being repainted, after your boxes are painted, with every frame of video. In other words, your constantly being painted over by the Media Player. I don't think your going to be able to get around this little problem considering Media Player paints (I think!) directly to the frame buffer, but I could be wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
With this set:
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
You need to determine when to redraw the control. Windows will not let you know. Other then a timer constantly repainting you controls, I see only one .Net way. Remove your CreateParams for the control and use a custom shape to do what you want. Simply create a control that is a box with no center. I will try to upload an example in a few.
|
|
|
|
|
|
Thanks alot, I´ll look into it.
|
|
|
|
|
Hello,
I have a user control which generates 2 events e.g. ItemSelected, ItemDoubleClicked.
When I create the user control in code and do not add a handler to one of the events, when the event fires I get "Object reference not set to an instance of an object." I am doing something wrong here? I assume I do not have to handle every event fired by my user control?
Many thanks,
Gary
|
|
|
|
|
Where exactly does the NullReferenceException originate from?
One reason could be that the user control tries to fire the event regardless of event listeners attached or not.
The correct way would be:
if (ItemSelected != null)
ItemSelected(this, new ItemSelectedEventArgs()); I guess the if (...) is missing.
Regards,
mav
|
|
|
|
|
That is indeed the problem, thanks very much.
What exactly is happening here though? ItemSelected is defined as an event linked to a delegate. When say a form creates my user control and assigns a method to the event what happens. I assume ItemSelected is then set as it is not null. If no handler is set then ItemSelected remains null?? What exactly happens here?
|
|
|
|
|
For each event a class defines it has an EventHandler member that's managing the delegates to invoke when the event is fired.
This EventHandler is created the first time a client subscribes to an event.
Until that moment the EventHandler variable is still assigned null, so calling any of its methods will throw the NullReferenceException .
mav
|
|
|
|
|
I would like to write an application which can send sms messages from a pc to any mobile cellular phone using C#. I would appreciate if any one can help me archieve this. Thanking you in advance.
Justin
mj
|
|
|
|
|
Hi Jasto,
Yes 4 years ago – now problem! But today all the telephone company’s charge you for sending a SMS via there servers. Earlier you could send it like an e-mail writing your message in the subject field and sending the mail to fx. xxxxxx@TDC.mobil.dk but today all the company’s I know of has close the service for public use, and you have to contact your telephone company to buy this server.
Sorry – the world is not always free
/ Magnus
|
|
|
|
|
Hi
maybe it would be simple but never tried..how can I access an Ms Access file(.mdb) by giving an IP address,i dnt find any such option in OleDb
-adnan
|
|
|
|
|
Since Access is a file-based database, you'll need file system access rights to the remote machine. There is no Access server for you to attach to! So, in your connection string, then data source would be just like any other Windows UNC path:
\\ip.address\share.name\folder\subfolder\AccessDatabase.mdb
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I used following before i give try to your approach
String remoteConnStr="Provider=MS Remote;Remote Server=127.0.0.1;Remote Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\iconfig.mdb";
String mysql=String.Empty;
OleDbConnection con=new OleDbConnection(remoteConnStr);
con.Open();
MessageBox.Show(con.State.ToString());
mysql="SELECT * FROM preferences";
OleDbCommand cmd = new OleDbCommand(mysql,con);
OleDbDataReader reader=cmd.ExecuteReader();
MessageBox.Show(reader.FieldCount.ToString());
i am getting exception on last line OleDbDataReader reader=cmd.ExecuteReader();,Con.state is displaying Open,so i assume connection is being established,the following exception is being thrown
System.InvalidCastException: Specified cast is not valid.
at System.Data.OleDb.OleDbException..ctor(IErrorInfo errorInfo, Int32 errorCode, Exception inner)
at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hResult, OleDbConnection connection, Object src)
any hint?
|
|
|
|
|
Well, I had no idea you we're using MS Remote, which is being deprecated by the way. I've never used it because I always use SQL Server or MSDE, never Access databases anymore...
From what I've seen in all the documentation, it only works over http, so, your Remote Server parameter should be:
...Remote Server=http:
and your machine should be running IIS.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'd like to add an UserAccess-Function to a SQL-Select-Statement.
It's a normal Statement like "Select * from Table Where Status = 'A'".
I'm loooking for a way like "... Where Status = 'A' And AccessFunction()"
or
bool lRes = AccessFunction();
sqlString = "... Where Status = 'A' And " + lRes.ToString();
I don't like to use UDF's, because the Application should work with several Databases like SQL-Server, Access, Foxpro, ... and I don't like same doing code at several places.
Has anyone a helpfull answer ?
Best thanks to you.
|
|
|
|
|
Try
sqlString = "... Where Status = 'A' And 1=" + ((int)lRes).ToString();
Ravindra Sadaphule
MCSD.NET
|
|
|
|
|
thanks & sorry,
seeing your answer I realized, that the second codesnippet in my question dosn't describe my real problem - my mistake.
I need a dynamic function call in my SQL-statement such like how in the first codesnippet described ("... Where Status = 'A' And AccessFunction()").
The real problem is, that the functions result depends in normal case on the fieldvalues of the selected records (but I don't like to use UDF's).
For instance, there are some access rules for various usergroups (usergroup "xy" may only see the customergroup "ABC", usergroup "yz" but the customergroup "CDE").
My solution now is to add an boolean field to the datasets table after the fill-command, calculate that for every selected record with my accessfunction and use it in my datagrids binded dataview as a rowfilter.
Do you know a better direct way for these problem ?
thanks for your help,
Rainer Ziebarth
|
|
|
|