|
Depending on how you've written your control (and how it inherits), something like the following might help:
theObject.AutoScrollPosition = new System.Drawing.Point(0, 0);
theObject.AutoScrollPosition = new System.Drawing.Point(0, Y);
|
|
|
|
|
Thanks man,
I managed to produce a similar solution myself, appreciate the reply!
Jim
|
|
|
|
|
hi,
i have an application to develop. one of its part is to make a form for the new users to register.
I have some restrictions on the user name that i should specify.
One of the restrictions is that a user name can not include special characters of any kind. (Don't ask me why cz the project manager wants so).
the following special characters are restricted:
~ ! @ # $ % ^ & * ( ) _ + = -| \ } ] { [ : ” ’ ; ? / > < , .
so if anybody has a regular expression for such a case please give it to me cz i am not that good in regular expressions.
Thanks in advance
best regards
|
|
|
|
|
quiteSmart wrote: the following special characters are restricted:
~ ! @ # $ % ^ & * ( ) _ + = -| \ } ] { [ : ” ’ ; ? / > < , .
But not characters like these?
" ' ` ¨ ½ § £ € Í Ò ñ å Ä ô ü ì î ä Ô Ë Ö Å ÿ õ
Those are just a few of the characters I can type directly on my keyboard. There are more, and then there are thousand of other special characters in the unicode character set.
You should define the characters that are allowed instead. That will be much easier.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
mmmmmmmmmmmmmmmmmmmmmmmmmmmmm
That's good.
Thank you man.
I will define it to accept only alphanumeric characters and that will be fine for the manager i think.
I should have thought about that before asking in here.
Thank you Guffa.
|
|
|
|
|
Guffa one more question plz
i am verry bad in regular expressions
so can you please tell me how to do that regular expression
|
|
|
|
|
Perhaps something like:
^[0-9A-Za-z]+$
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
hey man thanks a lot
i realy appreciate it.
i just did a single addition to the regex u gave me
it is now like this
^[0-9A-Za-z]{6,}$
i did that ccz i need to have more than 6 chars for the user name
thanks again ;)
|
|
|
|
|
hi ,
i want to add web reference to my project with a function. user can send a string to this function and it try to connect and take WSDL informations from the reference. are there anybody having information about this?
|
|
|
|
|
if you are using VS (Visual Studio) right click references in solution explorer and add "Web Reference"
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
i'm using Visual studio but i want to add wsdl s with codes. with functions.
|
|
|
|
|
hi!
i want to know how to change the back color of the toolbar.
with regards,
Asha.
hi!
|
|
|
|
|
Toolbar? Do you mean the menubar of a form?
__________________________________________________
Standards are great! Everybody should have one!
|
|
|
|
|
its toolbar on which we place buttons back , home and others...
hi!
|
|
|
|
|
private byte key = new byte();
// 24 bit key for 3DES
Key=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24);
private byte iv= {22,33,44,55,66,77,88,99};// 8 bit
this is what i have to do
i have done it in vb.net and i want do the same in c#
thanks,
ahmad.osama1984@gmail.com
|
|
|
|
|
Do you mean this: ?
byte[] key = new byte[24] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
byte[] iv = new byte[8] {22,33,44,55,66,77,88,99};
|
|
|
|
|
Hello everyone,
My problem is that I cannot sort my dataTable by date. I tried to use sorting filters ( with the Select command ) and also using a DataView. But nothing changes.
Is there a way to achieve this ?
Best regards.
.:: Something is Wrong ::.
|
|
|
|
|
is this a SQL problem ?
SELECT * FROM TABLE<br />
ORDER BY myDate DESC <br />
<br />
<br />
replace DESC with ASC for accending dates.
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
I have an image of a classroom. I want to get the position(coordinate) of every desk in it(the color of the desk is different from that of the background).
Are there any good and simple arithmetic to deal with this problem? It doesn't have to be very precise.
Thanks!
|
|
|
|
|
Hi,
I am creating one bitmap object, say of size 500 by 100. Using this object im
creating one Graphics obect and using that im drawing some rectangles and so. After that when i save the bitmap object, i will get all the rectangles. But problem is, if drawn rectangles from graphics objects are of greater width than of bitmap object, Graphical object display it correctly but bitmap object will clip the extra part of image. How to solve this?
Expecting favourable reply.............
Shivaprasad
|
|
|
|
|
What is the problem, really? If you draw a rectangle that is larger than the area that you are drawing on, it will be clipped. Everything works that way. If you draw a rectangle on the screen that is larger than your screen resolution, it will be clipped. It won't be drawing pixels in mid air beside your monitor.
There are only two possible ways to avoid the clipping:
:: Draw smaller rectangles.
:: Create a bigger Bitmap object to draw on.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Directly coming to the point, can I resize bitmap object at runtime?
By,
Shivaprasad
|
|
|
|
|
puttaraj wrote: can I resize bitmap object at runtime?
No. You have to create a new bitmap and copy the data.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Perhaps the FixedSize() method below will do what you're looking for (I decided to include the other methods in case you find something useful in them too).
For instance:
int fixedWidth = sourceImageObj.Width + 20;
int fixedHeight = sourceImageObj.Height;
Image newImageObj = ImageWork.FixedSize(sourceImageObj, fixedWidth, fixedHeight, backgroundColor);
would return an image object of size ('fixedWidth' * 'fixedHeight') with the original image proportionally scaled to the new size (and centered, with ten extra pixels to either side) and with the "extra" bits set to the value of 'backgroundColor.'
#region Class: ImageWork
public class ImageWork
{
public static System.Drawing.Image ClipImage(
System.Drawing.Image sourceImage,
System.Drawing.Rectangle sourceRect,
int targetWidth, int targetHeight)
{
System.Drawing.Rectangle targetRect = new
System.Drawing.Rectangle(0, 0, targetWidth, targetHeight);
return ClipImage(sourceImage, sourceRect,
targetWidth, targetHeight, targetRect,
System.Drawing.Color.Empty);
}
public static System.Drawing.Image ClipImage(
System.Drawing.Image sourceImage,
System.Drawing.Rectangle sourceRect,
int targetWidth, int targetHeight,
System.Drawing.Color bkgColor)
{
System.Drawing.Rectangle targetRect = new
System.Drawing.Rectangle(0, 0, targetWidth, targetHeight);
return ClipImage(sourceImage, sourceRect,
targetWidth, targetHeight, targetRect,
bkgColor);
}
public static System.Drawing.Image ClipImage(
System.Drawing.Image sourceImage,
System.Drawing.Rectangle sourceRect,
int targetWidth, int targetHeight,
System.Drawing.Rectangle targetRect,
System.Drawing.Color bkgColor)
{
System.Drawing.Bitmap returnImage = new
System.Drawing.Bitmap(
targetWidth, targetHeight,
System.Drawing.Imaging.PixelFormat.Format32bppRgb);
returnImage.SetResolution(
sourceImage.HorizontalResolution,
sourceImage.VerticalResolution);
System.Drawing.Graphics grImage =
System.Drawing.Graphics.FromImage(returnImage);
grImage.Clear(bkgColor);
grImage.InterpolationMode =
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
grImage.DrawImage(sourceImage,
targetRect,
sourceRect,
System.Drawing.GraphicsUnit.Pixel);
grImage.Dispose();
return returnImage;
}
public static System.Drawing.Image FixedSize(
System.Drawing.Image sourceImage,
int fixedWidth, int fixedHeight,
System.Drawing.Color bkgColor)
{
System.Drawing.Rectangle sourceRect = new System.Drawing.Rectangle
(0, 0, sourceImage.Width, sourceImage.Height);
System.Drawing.Rectangle targetRect = FixedSize_ResizeRectangle
(sourceImage.Width, sourceImage.Height, fixedWidth, fixedHeight);
return ClipImage(sourceImage, sourceRect,
fixedWidth, fixedHeight, targetRect, bkgColor);
}
public static System.Drawing.Image FixedSize_EmptyImage(
int fixedWidth, int fixedHeight,
System.Drawing.Color bkgColor)
{
return FixedSize(new System.Drawing.Bitmap(1, 1),
fixedWidth, fixedHeight, bkgColor);
}
public static System.Drawing.Rectangle FixedSize_ResizeRectangle(
int sourceWidth, int sourceHeight,
int fixedWidth, int fixedHeight
)
{
int targetMapOffsetX = 0;
int targetMapOffsetY = 0;
int targetMapWidth = 0;
int targetMapHeight = 0;
float dummyMapRatio = 0f;
FixedSize_ResizeRatios(
sourceWidth, sourceHeight,
fixedWidth, fixedHeight,
ref targetMapOffsetX, ref targetMapOffsetY,
ref targetMapWidth, ref targetMapHeight,
ref dummyMapRatio);
return new System.Drawing.Rectangle(
targetMapOffsetX, targetMapOffsetY,
targetMapWidth, targetMapHeight);
}
public static void FixedSize_ResizeRatios(
int sourceWidth, int sourceHeight,
int fixedWidth, int fixedHeight,
ref int targetMapOffsetX, ref int targetMapOffsetY,
ref int targetMapWidth, ref int targetMapHeight,
ref float targetMapRatio
)
{
targetMapOffsetX = 0;
targetMapOffsetY = 0;
targetMapWidth = 0;
targetMapHeight = 0;
targetMapRatio = 0f;
float targetMapRatioWidth = ((float)fixedWidth/(float)sourceWidth);
float targetMapRatioHeight =
((float)fixedHeight/(float)sourceHeight);
if (targetMapRatioHeight < targetMapRatioWidth)
{
targetMapRatio = targetMapRatioHeight;
targetMapOffsetX = System.Convert.ToInt16(
(fixedWidth - (sourceWidth * targetMapRatio))/2);
}
else
{
targetMapRatio = targetMapRatioWidth;
targetMapOffsetY = System.Convert.ToInt16(
(fixedHeight - (sourceHeight * targetMapRatio))/2);
}
targetMapWidth = (int)(sourceWidth * targetMapRatio);
targetMapHeight = (int)(sourceHeight * targetMapRatio);
}
}
#endregion
|
|
|
|
|
In an applicatin which programatically compiles a C# project, i am facing a problem in adding Resources like images. i read about EmbeddedResources method of class Compiler Parameter and tried to add the resources using it, but couldnt get the desired result. Can any one tell me how to add resources for ciompiling C# project???
Thanx in advance
|
|
|
|
|