|
He! It quite often is.
I poked around a bit and finally got this to work...
<asp:ImageButton id="ibRoles" runat="server" ImageUrl='<%# GetImageLink("pawn_glass_blue.gif") %>' CommandName="Roles" AlternateText="Roles" ToolTip="Edit roles"></asp:ImageButton>
<asp:ImageButton id="ibEdit" runat="server" ImageUrl='<%# GetImageLink("draw.gif") %>' CommandName="Edit" AlternateText="Edit" ToolTip="Edit resource"></asp:ImageButton>
<asp:ImageButton id="ibDelete" runat="server" ImageUrl='<%# GetImageLink("delete.gif") %>' CommandName="Delete" AlternateText="Delete" ToolTip="Remove resource"></asp:ImageButton>
with this...
protected string GetImageLink(string imageName)
{
return Request.Path.Substring(0,Request.Path.LastIndexOf("/")+1 )
+ "DesktopModules/My_Module/App_LocalResources/" + imageName;
}
I don't know what the original problem was due to the useless error message.
And.. for what it's worth, I am not just combining paths. I am yanking the filename off of the Request.Path and then appending the test of the path to it to get the location of the images.
Phillip H. Blanton
www.ComponentScience.net
Email: Phillip at that domain that you see one line above the line you are reading now.
|
|
|
|
|
I would like to enhance a standrd ToolBar by providing an ownerdrawn Panel for the n-most sub-menu item of which will contain icon images that represent various tools (like the MS Word "AutoShapes" dropdown tool selection Panel). This is easy enough to do.
The problem is on MeasureItem and DrawItem, I only have the object coordinates of the item being drawn relative to "itself" not to the screen or client region (From 0,0 to however big the ownerdrawn button will be). I do not have the "actual" screen coordinates in which the rectangular region is being drawn. If I had the screen coordinates, when the end-user performs a mouse click on the ownerdrawn panel (populated with icon images)...I will be able to determine exactly where inside the ownerdrawn region the user click.
Where on the screen or client area is the menuitem being drawn?
Any help would be greatly appreciated.
-------------------------------------------------------
|0,0 (screen) |
| I need -> ?,? |
| this at ---------------- |
| DrawItem. |0,0 (menuitem)| |
| | | |
| | | |
| | 500,500| |
| ---------------- |
| |
| |
| |
| 1000,1000 |
-------------------------------------------------------
Don
|
|
|
|
|
|
Actually, I've read through most of these ownerdrawn articles and have (I believe) exhausted all possiblities using this approach.
The problem I am having is this; not only to I have to draw a X by Y panel of images for the ownerdrawn ImageItem, I have to be able to determine which image (screen region) has been clicked on. The coordinates that I have availble to be during DrawItem or MeasureItem are the coordinates associated with region that will occupy the MenuItem. That region begins at 0,0 .... not 0,0 the upper left-hand corner of the screen or client area. 0,0 of the MenuItem.
I think the only way I am going to be able to do this is to some how determine where on the screen (or client area) the ownerdrawn MenuItem is being drawn so that I can correlate the Form MouseDown location with the location of the chosen image in the ownerdrawn MenuItem.
The functionality that I am trying to replicate is that of the MS Word "Drawing" tool bar. Specifically, the "AutoShapes" drop down menu, with sub-menus that have image selection panels. I would like to create something like this.
So, my real question is this;
How do I know the screen position that an ownerdrawn MenuItem is being drawn on?
Thanks,
Don
|
|
|
|
|
don ashworth wrote:
so that I can correlate the Form MouseDown location with the location of the chosen image in the ownerdrawn MenuItem.
I may be missing something here. Why don't you just add an event handler to the Click event for the MenuItem?
OK, let's say you want to implement drag functionality--click and hold and drag the mouse to the drawing surface. Yes, I can see this is a problem. But keep in mind that a menu can be activated from the keyboard, which is why you aren't given mouse events for menu items. Of course, a menu that is supposed to select a drawing tool sort of implies you have some sort of a mouse device to the drawing with!
Ugh. I guess if you want drag functionality, the solution is to not use an owner draw MenuItem. MenuItem has a "Select" event which is raised when the menu item is selected (not clicked)--for example, used to display help text about the menu item. From there, it seems you would have to place an owner drawn panel, or something. But you still have the same problem--how do you know the coordinates of the menu item for the Select event?
Nasty problem. Sorry I can't help more!
Marc
My website
Latest Articles:
Undo/Redo Buffer
Memento Design Pattern
|
|
|
|
|
No sweat. Thanks for entertaining the question. Eventhough I do not have a solution yet, I fell better that at least one other person has come to the same conclusion. Looks like I need to write a home grown n-level menu.
Thanks again,
Don
|
|
|
|
|
Hello,
I'm trying to retrieve a page from a webserver, but I keep getting a "The server committed a protocol violation. Section=ResponseStatusLine" error in my program. This is using a the very simple code below:
<br />
string hostURL = "http://patft.uspto.gov";<br />
string URLSuffix = "/netacgi/nph-Parsernetacgi/" + "nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1" + "&u=/netahtml/srchnum.htm&r=1&f=G&l=50&" + "s1=6223224.WKU.&OS=PN/6223224&RS=PN/6223224";<br />
<br />
string lcUrl = hostURL + URLSuffix;<br />
HttpWebRequest webrequest =<br />
(HttpWebRequest)WebRequest.Create(lcUrl);<br />
webrequest.Timeout = 10000;
webrequest.UserAgent = "Code Sample Web Client";<br />
webrequest.ContentType = "text/html";<br />
webrequest.AllowAutoRedirect = true;<br />
<br />
HttpWebResponse loWebResponse = HttpWebResponse)webrequest.GetResponse();<br />
Encoding enc = Encoding.GetEncoding(1252);
StreamReader loResponseStream =<br />
new StreamReader(loWebResponse.GetResponseStream(), enc);<br />
string lcHtml = loResponseStream.ReadToEnd();<br />
<br />
loWebResponse.Close();<br />
loResponseStream.Close();<br />
The problem appears, via HTTP trace, that the server is returning a code "200 Script results follow". I also downloaded the HTTP sniffer from The Code Project (HTTPeep) which did not function (threw off same error). Linux wget chokes as well.
Is there any way to force the program to treat that server code as a "200 OK" code, or to otherwise ignore it?
Thanks in advance,
Colin
|
|
|
|
|
I'm writing a progarm (mentioned in a previous posting) that populate a data grid, via a dataView whose "table" property is a DataTable. I've noticed that whenever I rerun the program, the listing on the dataGrid changes. The records are not loaded in the same order at all. The table is not changed at all, and the DataView.Sort property is set against 3 columns DataView.Sort = "ColName1, ColName2, ColName3";
any suggestions on how I can keep the row index of the DataTable from changing at every app restart?
Thanks
|
|
|
|
|
hi,
Can't you get row Index using this?:
this.dataGrid1.CurrentRowIndex.ToString()
dataGrid1 is a instance of DataGrid,
Regards,
pubudu.
|
|
|
|
|
I can, but since I'm selecting several rows at a time, the currentRowIndex doesn't help me.
|
|
|
|
|
hi,
You can get row index,If you select several rows:-
int a=dataGrid1.VisibleRowCount;
for(int i=0;i<a;i++)
{
if(datagrid1.isselected(i))
messagebox.show("row is="" "+i);
}
<="" b="">
regards,
pubudu.
|
|
|
|
|
Is it possible to use a custom control I made without including the dll along with the executable?
Thanks in advance.
|
|
|
|
|
Plainly not. You can't write code and have it execute on a machine you don't deploy it to.
You can write a custom control in the same project as your executable, then there is no dll.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah but then I cant use the form designer in Visual Studio...
Thanks for clearing this up for me though.
|
|
|
|
|
I am trying to send some message to an embeded device.
its a very simple protocol ,
for example., according to the documentation , When a client send a packet"0x0000", the device reboot, when send "0x0011 0x0001", the device start to
to rotate a certain degree.
I am a newbie to network programming, need a quick example on how to send a packet to a tcp/ip listener.
Thanks a lot!
|
|
|
|
|
Well, it may be self serving, but TransPort is the simplest way.
http://www.componentscience.net/elements/transport
Phillip H. Blanton
www.ComponentScience.net
Email: Phillip at that domain that you see one line above the line you are reading now.
|
|
|
|
|
Hi
I am working for a business company and build software for it as a developer(Web/Win).
But we have familirized ARIS and Rationalrose is told it builds any solution the Enterprise needs in a fast and lower cost using UML and Business Process Models.
My question is :
I will be fired ?
Their Solutions are as Complete as company would not need to me?
|
|
|
|
|
With software services like that, companies are tied to paying expensive consultants to write software how *they* think it should work, then pay the same consultants for maintenance, upgrades, and repairs.
Will you be fired? Haha somehow your whole post seems screwy with almost rhetorical questions written in poor English.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: The Secular Left, the Religious Right, and Prejudice
Judah Himango
|
|
|
|
|
|
I insert an OLe Object into my access DataBase and i found it saves as Pakager i don't understand what Pakager means and i can't retrieve the image from database to use it in my C# codes
plz i need help to write the query stmt for that
thanks
misho
|
|
|
|
|
|
Hi all,
I am trying to connect to an ACCESS database and read data from it. I believe the connection opens and closes fine, but when I add the line to Read from the data (ExecuteReader) I get the following exception error:
[An unhandled exception of type 'Microsoft.Data.Odbc.OdbcException' occurred in microsoft.data.odbc.dll]
////////////here is the code:
string connection= "Driver={Microsoft Access Driver (*.mdb)};"
+ "Dbq=I:\\ACCESS2000\\US_MASPS.mdb;" ;
OdbcConnection myConnection = new OdbcConnection(connection);
myConnection2.Open();
string select = "SELECT * from US_MASPS.TBLGMS"
+" WHERE SeqNo = 12";
OdbcCommand aCommand = new OdbcCommand(select, myConnection);
OdbcDataReader aReader = aCommand.ExecuteReader();
/////////////
I also downloaded and installed the latest MDAC and the ODBC driver (unless there is other stuff to be installed I am not aware of!)
Thanks in advance
|
|
|
|
|
hi,
first please put all the code part in the try and catch block.
then you easy to find the correct Error.
You are telling "when I add the line to Read from the data (ExecuteReader) I get the following exception error:
"
Then definitely it is not connection error ..It is a Error in the query you try to execute.
please check wheter the Table name and every thing is coeect in the Query.
regards,
pubudu
|
|
|
|
|
I have to make for school a project in C# that does the work of router.
I mean that i have to check on certain ports for an incomming connections and then check if there is a rule made for this port. If there is rule made for this then i have to forward this connection to a certain ip address or block it.
My user interface is done and i even created a service which will do the handling of the connections.
But i am stuck now with how will i forward a connection.
This is some of the function i made:
This is the function to create the socket:
{
LocalSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
LocalSocket.Blocking = false;
LocalSocket.Bind(new IPEndPoint(IPAddress.Parse(GetLocalIP()),
LocalRole.GetSourcePort()));
}
after that i call this function:
public void Start()
{
IAsyncResult ar = LocalSocket.BeginReceive(receive_buf_bytes, 0, len_receive_buf, SocketFlags.None, new AsyncCallback(CallReceive), this);
}
and this is the function that should forward the connection but i am not sure how to complete it:
private void CallReceive(IAsyncResult ar)
{
int received_bytes;
received_bytes = LocalSocket.EndReceive(ar);
//Receive(receive_buf_bytes, received_bytes);
if(LocalRole.GetSourceIp() != "0.0.0.0")
{
if(LocalRole.GetSourceIp() == ((IPEndPoint)(LocalSocket.RemoteEndPoint)).Address.ToString())
{
}
Start();
}
Could someone explain me how i should make this function to forward the connection?
thx
cyrus
|
|
|
|
|
Here is a generic Proxy class that forwards connections
class Proxy
{
private string appName = "HSMSProxy";
[STAThread]
static void Main(string[] args)
{
new Proxy().Start();
}
public void Start()
{
TcpListener listener = new TcpListener(5001);
listener.Start();
TcpClient activeEntity = listener.AcceptTcpClient();
TcpClient passiveEntity = new TcpClient("TargetMachine", 5002);
NetworkStream activeStream = activeEntity.GetStream();
NetworkStream passiveStream = passiveEntity.GetStream();
new InterStreamWriter(activeStream, passiveStream).Start();
new InterStreamWriter(passiveStream, activeStream).Start();
Console.ReadLine();
}
private void Log(string message)
{
Console.WriteLine(message);
}
}
class InterStreamWriter
{
NetworkStream readStream;
NetworkStream writeStream;
public InterStreamWriter(NetworkStream readStream, NetworkStream writeStream)
{
this.readStream = readStream;
this.writeStream = writeStream;
}
public void Start()
{
new System.Threading.Thread(new System.Threading.ThreadStart(ThreadFunc)).Start();
}
private void ThreadFunc()
{
while (true)
{
ArrayList byteList = new ArrayList();
byte[] myReadBuffer = new byte[1024];
int numberOfBytesRead = 0;
do
{
numberOfBytesRead = readStream.Read(myReadBuffer, 0, myReadBuffer.Length);
for (int i = 0; i<numberOfBytesRead; ++i)
byteList.Add(myReadBuffer[i]);
}
while(readStream.DataAvailable);
byte[] totalBuffer = (byte[])byteList.ToArray(typeof(byte));
writeStream.Write(totalBuffer, 0, totalBuffer.Length);
writeStream.Flush();
byteList.Clear();
}
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|