|
No inherited property can be truly hidden. There are several ways to hide them from the designer, but they will still show up in intellisense.
Any derived class should implement anything in its base or call the bases own implementation.
The only true way to not have any properties apart from your own is to build your own from scratch without deriving from UserControl (or Control) or start with Component as it has no properties except Container and Site.
UserControl Inheritance Tree
----------------------------
UserControl : ContainerControl<br />
ContainerControl : ScrollableControl, IContainerControl<br />
ScrollableControl : Control, IComponent, IDisposable<br />
Control : Component, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable<br />
Component : MarshalByRefObject, IComponent, IDisposable
As you can see, there's alot of inheritance going on when you use UserControl
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Can you explain me with example?
using System.ComponentModel;
class TestControl : Container
{
}
Here I am not getting interface for 'Site'.
|
|
|
|
|
using System.ComponentModel;
public class TestControl : Component
{
}
Derive from Component not Container. Any instance of TestControl only has two properties; Site and Container, unless you add more yourself of course.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
hi why this code didn't execute??? what are my errors
using System;
using System.Runtime.InteropServices;
namespace StgOpen
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
public enum STGM:int
{
DIRECT= 0X00000000,TRANSACTED=0X00010000,READ=0X00000000}
[ComImport]
[Guid("0000000b-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPropertyStorage
{
void CreateStream(
/* [string][in] */ string pwcsName,
/* [in] */ uint grfMode,
/* [in] */ uint reserved1,
/* [in] */ uint reserved2,
/* [out] */ out IStream ppstm);
void OpenStream(
/* [string][in] */ string pwcsName,
/* [unique][in] */ IntPtr reserved1,
/* [in] */ uint grfMode,
/* [in] */ uint reserved2,
/* [out] */ out IStream ppstm);
void CreateStorage(
/* [string][in] */ string pwcsName,
/* [in] */ uint grfMode,
/* [in] */ uint reserved1,
/* [in] */ uint reserved2,
/* [out] */ out IStorage ppstg);
void OpenStorage(
/* [string][unique][in] */ string pwcsName,
/* [unique][in] */ IStorage pstgPriority,
/* [in] */ uint grfMode,
/* [unique][in] */ IntPtr snbExclude,
/* [in] */ uint reserved,
/* [out] */ out IStorage ppstg);
void CopyTo(
/* [in] */ uint ciidExclude,
/* [size_is][unique][in] */ Guid rgiidExclude, // should this be an array?
/* [unique][in] */ IntPtr snbExclude,
/* [unique][in] */ IStorage pstgDest);
void MoveElementTo(
/* [string][in] */ string pwcsName,
/* [unique][in] */ IStorage pstgDest,
/* [string][in] */ string pwcsNewName,
/* [in] */ uint grfFlags);
void Commit(
/* [in] */ uint grfCommitFlags);
void Revert();
void EnumElements(
/* [in] */ uint reserved1,
/* [size_is][unique][in] */ IntPtr reserved2,
/* [in] */ uint reserved3,
/* [out] */ out IEnumSTATSTG ppenum);
void DestroyElement(
/* [string][in] */ string pwcsName);
void RenameElement(
/* [string][in] */ string pwcsOldName,
/* [string][in] */ string pwcsNewName);
void SetElementTimes(
/* [string][unique][in] */ string pwcsName,
/* [unique][in] */ FILETIME pctime,
/* [unique][in] */ FILETIME patime,
/* [unique][in] */ FILETIME pmtime);
void SetClass(
/* [in] */ Guid clsid);
void SetStateBits(
/* [in] */ uint grfStateBits,
/* [in] */ uint grfMask);
void Stat(
/* [out] */ out STATSTG pstatstg,
/* [in] */ uint grfStatFlag);
}
[StructLayout(LayoutKind.Sequential)]
public struct STGOPTIONS
{
[FieldOffset(0)] ushort usVersion;
[FieldOffset(2)] ushort reserved;
[FieldOffset(4)] uint uiSectorSize;
[FieldOffset(8),MarshalAs(UnmanagedType.LPWStr)]string pwcsname;
}
[DllImport("ole32.dll")]
public static extern int StgOpenStorageEx([MarshalAs(UnmanangedType.lPWStr)]
string pwcsname,int grfMode,int stgfmt,int grfAttrs,ref STGOPTIONS pStgOptions,
IntPtr reserved2,[In] ref Guid riid,[MarshalAs(UnmanangedType.IUnknown)] out object ppobjectOpen);
}
[STAThread]
public static void Main(string[] args)
{
string file=@"E:\\Miss_Hacker.doc";
int result=StgOpenStorageEx(file,STGM.READ,STGFMT.DOCFILE,2,null,IntPtr.zero,ref IID_IPropertyStorage,out object ppObjectOpen);
Console.WriteLine("{0}",result);
}
}
|
|
|
|
|
First, what does it do? Second, what is it NOT doing?? Third, what do you EXPECT it to do??
Next, why are you not asking the person who wrote it? Found here...[^]
Lastly, why not use Outlook interop to do this instead.
|
|
|
|
|
hi
my project is hiding data in unused space in structured of microsoft word document 2003, and i founed that i must use structure storage API for accessing the Root ,header .......
so i wrote this code, this code trying to open Root(storage) so can enter o the header
using C# 2003, am asking hear for along time ..... wishing some one help me
Thanx
|
|
|
|
|
You're not going to get much space to make this useful. At least, not without corrupting a Word document. Besides, it's got a limited lifespan. Office 2007 and above now uses an open format XML file to store documents. There's no longer any place to "hide" data.
You may want to consider using alternate streams, but there's a catch. If you copy the file to a non-NTFS formatted device, the data in the alternate streams will be lost.
You're not getting any useful answers because the knowledge base out there is so limited. Noone, besides Microsoft anyway, delves into the old Word file formats for any reasons. It's very unlikely your ever going to find anyone with any experience with it.
|
|
|
|
|
Dave Kreskowiak wrote: Office 2007 and above now uses an open format XML file to store documents. There's no longer any place to "hide" data.
Don't bet on it. A friend of mine completed his final year project on information hiding and he demonstrated the ability to hide a message by using the IP header to deliver the payload. That's an open standard too. It was a fascinating project.
|
|
|
|
|
How big is the payload? Last I heard, you couldn't fit anything much bigger than an SMS message in it.
|
|
|
|
|
Dave Kreskowiak wrote: How big is the payload?
256 bytes.
Dave Kreskowiak wrote: Last I heard, you couldn't fit anything much bigger than an SMS message in it.
The IP header (not TCP/IP) is only 20 bytes. It worked by virtue of the fact that a packet is about 1.5k and to download an average web page required that quite a few packets are sent. Each packet had a different part of the message. Once you had 256 packets you have the full message (at best). The algorithm used was quite clever becuase it took account of the fact that other things may be interacting with the server, so if you missed part of the message it would send it again.
The software on the client was just a .NET application using sockets in promiscuous mode. Each packet was then examined and the message was gradually pieced together. To get the data you just browsed the innocuous website on the server in your favourite browser.
|
|
|
|
|
Makes perfect sense. Obviously not to the subject of Word Documents but anyway, thanks Colin
led mike
|
|
|
|
|
I'm sure I've answered you before but I can't be bothered to look. You're persistant at least - I'll give you that.
A quick bit of Googling revealed this page[^] that gives you code in C to write and read.
You may need to build this yourself to a dll in C++ and then provide a c# wrapper to it.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Miss_hacker wrote: why this code didn't execute??? what are my errors
Did it tell you anything? Or do you just expect people to read your mind?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
If I want a button to be repainted permanently at the click of the same button, how can I do?
So far I have tried to send the button as sender after it has been clicked to the button's paint event. This only works to some extent, the repainting comes on but as soon as the mouse cursor leaves the button, the repainting wears off.
I am looking for a way to make the repainting stay on permanently.
|
|
|
|
|
This may seem like a silly answer (I never use the painting stuff and I'm really having trouble saying this without sounding like a prat), what's wrong with the background/foreground settings. Why are you trying to "repaint" it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Not a silly question at all. I am trying to repaint it because the next course in school will have exercises where repainting in this manner is necessary. I am just trying to get prepared.
|
|
|
|
|
You really can't do this because your going to tie up the UI thread with constant WM_PAINT messages. You won't be able to do anything else in the application.
Perhaps a better explanation of what the point of repainting a button would help? And don't say "because that's what were doing in class"...
|
|
|
|
|
Sounds like you need to set a flag that you can test to see if your painting should be used everytime the control is Invalidated and test that flag in the overridden OnPaint.
This site[^] has some cool user button codes that you may find useful.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi!
I need the coding for inserting image in header/footer of a word document using c#, Windows Application.
Thank you...
|
|
|
|
|
No.2[^]
While (true) { Human.isLearnable = true; }
|
|
|
|
|
|
Morning fellow code writers...
I have a try and catch process that is giving me fits...If I eliminate the throw new Exception(ex.Message); line I get an error: Error 3 Use of unassigned local variable 'tbl'.
Can somebody enlighten me as to why this is happening??
catch (Exception ex)
{
MessageBox.Show("The following error occurred :" + ex.Message, Application.ProductName,
MessageBoxButtons.OK, MessageBoxIcon.Information);
string logFile;
string logPath = Application.StartupPath + "\\logs\\";
logFile = (logPath + global.logDate + ".log");
StreamWriter writer = new StreamWriter(logFile, true, System.Text.Encoding.ASCII);
writer.WriteLine(System.DateTime.Now);
writer.WriteLine("[Process #]");
writer.WriteLine("[get data]");
writer.WriteLine(ex.Message);
writer.WriteLine("\r");
writer.Close();
throw new Exception(ex.Message);
}//end of catch
return tbl;
}
}//end of class name
}//end of namespace
TIA
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Rafone wrote: return tbl;
What is this "tbl"?
While (true) { Human.isLearnable = true; }
|
|
|
|
|
I guess you always throw an exception in the try block as well. If that's the case, the return statement would never execute and the compiler ignored the fact that you used tbl without assigning a value to it. If you remove the throw statement (either in the catch or in the try block), that line of code would execute and therefore the compiler complains.
|
|
|
|
|
I guess you are assigning value to tbl in try block don't you? If an exception occurs then tbl variable can be unassigned so if you remove throw new Exception(ex.Message); from your catch block then the function must return tbl but it will be unassigned hence the error. On the other hand, throwing new exception means that there is no need to return tbl.
By the way, why don't you use log4net[^] for logging purposes?
|
|
|
|
|