半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-11-07 16:28:10

您可以创建 2 个 .css 文件,一个用于标准视图,一个用于“禁用”视图,并设置您自己的按钮属性。编写一个函数来更改要使用的 .css 文件。

You can create 2 .css files, one for the standard view and one for the "disabled" view and set your own button properties. Write a function which changes the .css file to use.

使用 CSS 使禁用的 Flex Spark 按钮更具可读性

半城柳色半声笛 2024-11-07 12:55:10

TActionList 添加到您的表单中。向其中添加 TAction 并像处理其他控件的 OnClick 事件一样处理其 OnExecute 事件。指定控件的 Action 属性以引用您添加到操作列表中的操作。 (这也会导致控件从关联的操作中获取其标题以及启用和可见属性。这意味着当菜单和工具栏按钮表示相同的命令时,可以更轻松地使它们具有统一的状态。)

Add a TActionList to your form. Add a TAction to it and handle its OnExecute event as you would the OnClick event of some other control. Assign the Action properties of the controls to refer to the action you added to the action list. (This also causes the controls to acquire their captions and enabled and visible properties from the associated action. It's meant to make it easier to have menus and toolbar buttons have uniform states when they represent the same command.)

Delphi 中的 VB [(Function) 句柄 ...] 等效项

半城柳色半声笛 2024-11-07 10:08:57

您可能想尝试一下

io.popen([[C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/vcpackages/vcbuild.exe]], "r")

,请注意,您正在使用一个如下所示的参数调用该函数:

"C:/.../vcbuild.exe", "r"

You might want to try

io.popen([[C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/vcpackages/vcbuild.exe]], "r")

Note that you were calling the function with one argument that looked like this:

"C:/.../vcbuild.exe", "r"

Lua 和操作系统的空白。怎么解决?

半城柳色半声笛 2024-11-07 09:59:43

据我所知,候选键是可以用作主键的唯一键。但不一定用作一个。

复合键是唯一标识行的两个或多个属性的键。

As I know candidate key is a unique key that can be used as a primary key. but not necessarily used as one.

Composite key is a key of two or more attributes that uniquely identifies the row.

候选键和复合键有什么区别?

半城柳色半声笛 2024-11-07 09:36:34

当您没有该文档类型时,您的页面将以Quirks 模式呈现。

在 Quirks 模式下,inputborderpadding 计入 300px内部 > 宽度。

当您添加文档类型时,您的页面将以标准模式呈现,并且边框 和 padding 不再是 300px 的一部分 - 这就是“额外”4px 的来源。

请参阅此处:http://www.quirksmode.org/css/box.html

对于现代浏览器“修复”此问题的最简单方法是使用 box-sizing: border -box

input
{
    width: 300px;

    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

或者,您可以自己显式设置paddingborder-width,以确保值的总和>paddingborder-widthwidth 总计为 300px

When you don't have that doctype, your page is rendering in Quirks Mode.

In Quirks Mode, the border and padding of the input are counted inside the 300px width.

When you add the doctype, your page is rendering in Standards Mode, and the border and padding are no longer part of the 300px - that's where the "extra" 4px is coming from.

See here: http://www.quirksmode.org/css/box.html

The easiest way to "fix" this for modern browsers is to use box-sizing: border-box:

input
{
    width: 300px;

    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

Or, you can explicitly set the padding and border-width yourself, to make sure the sum of the values of padding, border-width and width add up to 300px.

;输入元素宽度渲染问题

半城柳色半声笛 2024-11-07 09:35:30

集成到 C# 应用程序中并不意味着您必须使用 C# - 您可以使用 C++ 或其他语言编写代码,并使用 p/invoke 从 C# 调用它。但是,除非你在 C# 中做一些效率很低的事情,否则你可以获得相当不错的性能(我的工作本质上是用 C# 编写的飞行模拟器,并且它的性能相当高 - 没有我们用 C++ 所能达到的那么高,但仍然是一个完全可行/现实的替代方案,而且开发速度要快得多)。

然而,除非您正在为规格非常低的 CPU 编写实时应用程序,并且它已经在努力跟上其任务,否则以任何可能的帧速率加载和显示 100kB 图像应该不成问题。

由于您没有真正指定您可以做什么的范围,因此很难给出准确的答案。

一般来说,为了获得良好的渲染/位块传输性能,优先使用 DirectX/OpenGL(而不是 GDI)是有意义的。

如果您可以控制它,那么您可以使用许多文件格式来提高速度(通过很好地压缩数据以最大限度地减少要加载的数据量,和/或通过使用硬件解压缩方法,更好的数据流和缓存方法、预处理以优化图像数据以适应目标硬件等)。如果您有如此大的灵活性,您也许可以使用视频播放库甚至外部视频播放应用程序来为您完成所有工作,而您只需用 C# 编写一些简单的“控制逻辑”即可。这将为您带来比您自己的解决方案更高效的系统。

Integrating into a C# application does not mean you have to use C# - you can write code in C++ or other languages and use p/invoke to call it from C#. But unless you're doing something really inefficient in C# you can get pretty decent performance out of it (I work on what is essentially a flight simulator written in C#, and it's pretty high performance - not as high as we could achieve with C++, but still a perfectly viable/realistic alternative, and it's so much faster to develop).

However, unless you are writing a realtime app for a very low-spec CPU and it's already struggling to keep up with its tasks, loading and displaying a 100kB image at any likely framerate shouldn't be much of a problem.

As you don't really specify the bounds of what you can do, it's hard to give a precise answer.

In general, it would make sense to use DirectX/OpenGL in preference to GDI in preference to GDI+ to get decent rendering/blitting performance.

If you have control over it, then there are many file formats that you can use which will help the speed (by compressing the data well to minimise the amount of data to be loaded, and/or by using hardware decompression approaches, better data streaming and caching approaches, pre-processing to optimise the image data to suit the target hardware, etc). If you have this much flexibility you may be able to use a video playback library or even an external video playback application that will do all the work for you, leaving you to write a trivial bit of "control logic" in C#. This will get you a much more efficient system than you are likely to achieve by rolling your own solution.

在 C# 中播放图像序列

半城柳色半声笛 2024-11-07 09:08:57

这对你有用。

 pickerViewcontroller.h

#import <UIKit/UIKit.h>
#define kStateComponent 0
#define kZipComponent 1

    @interface PickerViewController : UIViewController
    <UIPickerViewDataSource,UIPickerViewDelegate>{
        IBOutlet UIPickerView *dpicker;
        NSDictionary *stateZip;
        NSArray *states;
        NSArray *zips;

    }
    @property (nonatomic,retain) UIPickerView *dpicker;
    @property (nonatomic,retain) NSDictionary *stateZip;
    @property (nonatomic, retain) NSArray *states;
    @property (nonatomic, retain) NSArray *zips;
    @end


pickerViewcontroller.m

#import "PickerViewController.h"


@implementation PickerViewController
@synthesize dpicker;                  
@synthesize stateZip;
@synthesize states;
@synthesize zips;


-(void) viewDidLoad{

    NSBundle *bundle = [NSBundle mainBundle];

    NSString *plistPath =[bundle pathForResource:@"plistfilename" ofType:@"plist"];

    NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
    self.stateZip=dictionary;
    [dictionary release];


    NSArray *component = [self.stateZip allKeys];
    NSArray *sorted =[component sortedArrayUsingSelector:@selector(compare:)];
    self.states=sorted;


            NSString *selectedState = [self.states objectAtIndex:0];
        NSArray *array = [stateZip objectForKey:selectedState];
    self.zips = array;


}




#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
}

- (void)dealloc {
    [dpicker release];
    [stateZip release];
    [states release];
    [zips release];
    [super dealloc];
}
#pragma mark-
#pragma mark picker Data Source Methods
-(NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerview
{
    return 2;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    if (component == kStateComponent)

        return [self.states count];

    return [self.zips count];
}
#pragma mark picker delegate Methods
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row
           forComponent:(NSInteger)component
{


    if(component == kStateComponent)

        return[self.states objectAtIndex:row];



    return [self.zips objectAtIndex:row];

}
-(void)pickerView:(UIPickerView *)pickerView  didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
        if(component == kStateComponent)
    {

        NSString *selectedState = [self.states objectAtIndex:row];
        NSArray *array=[stateZip objectForKey:selectedState];
        self.zips=array;
        [dpicker selectRow:0 inComponent:kZipComponent animated:YES];
        [dpicker reloadComponent:kZipComponent];
    }
}


@end

it useful for u.

 pickerViewcontroller.h

#import <UIKit/UIKit.h>
#define kStateComponent 0
#define kZipComponent 1

    @interface PickerViewController : UIViewController
    <UIPickerViewDataSource,UIPickerViewDelegate>{
        IBOutlet UIPickerView *dpicker;
        NSDictionary *stateZip;
        NSArray *states;
        NSArray *zips;

    }
    @property (nonatomic,retain) UIPickerView *dpicker;
    @property (nonatomic,retain) NSDictionary *stateZip;
    @property (nonatomic, retain) NSArray *states;
    @property (nonatomic, retain) NSArray *zips;
    @end


pickerViewcontroller.m

#import "PickerViewController.h"


@implementation PickerViewController
@synthesize dpicker;                  
@synthesize stateZip;
@synthesize states;
@synthesize zips;


-(void) viewDidLoad{

    NSBundle *bundle = [NSBundle mainBundle];

    NSString *plistPath =[bundle pathForResource:@"plistfilename" ofType:@"plist"];

    NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
    self.stateZip=dictionary;
    [dictionary release];


    NSArray *component = [self.stateZip allKeys];
    NSArray *sorted =[component sortedArrayUsingSelector:@selector(compare:)];
    self.states=sorted;


            NSString *selectedState = [self.states objectAtIndex:0];
        NSArray *array = [stateZip objectForKey:selectedState];
    self.zips = array;


}




#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
}

- (void)dealloc {
    [dpicker release];
    [stateZip release];
    [states release];
    [zips release];
    [super dealloc];
}
#pragma mark-
#pragma mark picker Data Source Methods
-(NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerview
{
    return 2;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    if (component == kStateComponent)

        return [self.states count];

    return [self.zips count];
}
#pragma mark picker delegate Methods
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row
           forComponent:(NSInteger)component
{


    if(component == kStateComponent)

        return[self.states objectAtIndex:row];



    return [self.zips objectAtIndex:row];

}
-(void)pickerView:(UIPickerView *)pickerView  didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
        if(component == kStateComponent)
    {

        NSString *selectedState = [self.states objectAtIndex:row];
        NSArray *array=[stateZip objectForKey:selectedState];
        self.zips=array;
        [dpicker selectRow:0 inComponent:kZipComponent animated:YES];
        [dpicker reloadComponent:kZipComponent];
    }
}


@end

如何将plist中的数据拉取到UIPickerView?

半城柳色半声笛 2024-11-07 08:44:44

下面是一个示例:

char myChar = '|';
string myString = "||";

字符由单引号分隔,字符串由双引号分隔。

好消息是 C# switch 语句可以使用字符串!

switch (mytoken)
{
    case "==":
        //Something here.
        break;
    default:
        //Handle when no token is found.
        break;
}

Here's an example:

char myChar = '|';
string myString = "||";

Chars are delimited by single quotes, and strings by double quotes.

The good news is C# switch statements work with strings!

switch (mytoken)
{
    case "==":
        //Something here.
        break;
    default:
        //Handle when no token is found.
        break;
}

“字符文字错误中字符过多”

半城柳色半声笛 2024-11-07 08:37:20

您确实将 CCSprites 添加到了 CCLayer 中,不是吗?那么 CCLayer 应该可以访问它们。因此,您可以使用 CCLayer 的 tick 函数来跟踪 CCSprites 的位置,并在它们的边界框重叠时触发操作。

一些示例代码来说明:

@interface MyLayer : CCLayer {
  BombSprite *bomb;
  PlayerSprite *player;
}

...

@end

@implementation MyLayer

- (id)init {
   if ((self = [super init])) {
      bomb = ...
      player = ...

      [self schedule:@selector(tick:)];
   } 
   return self;
}

- (id)tick:(ccTime)dt {
   if (CGRectContainsRect([bomb boundingBox], [player boundingBox])) {
      NSLog(@"Collision!");

      // call [player didCollideWith:bomb] or something
      ...
   }
}

@end

You did add the CCSprites to a CCLayer, didn't you? Then that CCLayer should have the access to both of them. So, you can use the CCLayer's tick function to track the positions of the CCSprites and trigger actions if their bounding boxes overlap.

Some sample code to illustrate:

@interface MyLayer : CCLayer {
  BombSprite *bomb;
  PlayerSprite *player;
}

...

@end

@implementation MyLayer

- (id)init {
   if ((self = [super init])) {
      bomb = ...
      player = ...

      [self schedule:@selector(tick:)];
   } 
   return self;
}

- (id)tick:(ccTime)dt {
   if (CGRectContainsRect([bomb boundingBox], [player boundingBox])) {
      NSLog(@"Collision!");

      // call [player didCollideWith:bomb] or something
      ...
   }
}

@end

iPhone 开发>从 cocos2d 中的其他对象获取 CCSprite 位置?

半城柳色半声笛 2024-11-06 23:31:07

可以使 PHP 脚本使用 SSH 登录到另一台服务器,但这非常复杂。

在远程服务器上拥有一个可公开访问的 PHP 文件、通过 Web 调用该文件并让它执行您需要的任何操作可能要容易得多。

It is possible to make a PHP script log on to another server using SSH, but it's very complicated.

It's probably much, much easier to have a publicly accessible PHP file on the remote server, call that through the web, and have it perform whatever actions you need.

从 PHP 文件发送脚本

半城柳色半声笛 2024-11-06 21:36:18

这不起作用,因为您将 head 元素放在 body 中 - 而不是 HTML 的工作方式。

你可以这样做

$('iframe').contents().find('html').load('/user/profile');

......

编辑:

lonesomeday 提出了一个非常好的观点。为什么不直接改变 iframe 的 src 呢?

$('iframe').attr('src', '/user/profile');

This won't work because you are putting the head element inside body - not how HTML works.

You could do

$('iframe').contents().find('html').load('/user/profile');

instead....

EDIT:

lonesomeday makes a very good point. Why not just change the iframes's src?

$('iframe').attr('src', '/user/profile');

将内容添加到 iframe

半城柳色半声笛 2024-11-06 19:51:46

由于您仅将 String.Format 与格式字符串一起使用,因此 sumKV 会根据应用程序中实际使用的 UI 区域性进行格式化。

GridView1.FooterRow.Cells[11].Text = String.Format("{0:c}", sumKV),

要摆脱货币符号,请在 String.Format 中使用 InvariantCulture,如下所示:

String.Format(CultureInfo.InvariantCulture, "{0:c}", sumKV);

Because you are using String.Format with a format string only, sumKV is formatted according to the UI Culture actually used in your application.

GridView1.FooterRow.Cells[11].Text = String.Format("{0:c}", sumKV),

To get rid with currency symbol, use InvariantCulture in String.Format this way :

String.Format(CultureInfo.InvariantCulture, "{0:c}", sumKV);

String.Format 相同代码不同视图

半城柳色半声笛 2024-11-06 13:42:40

事实证明,这只是一个长期被注意到的问题的变体,即当 (a) 用户在重定向后到达当前页面,以及 (b) 您更改 window.location 时,Internet Explorer 会刷新页面.hash。换句话说,这是一个 IE 问题(在 IE9 中仍然没有修复!),而不是 Silverlight 问题。 Firefox 和 Chrome 一切正常。 (请参阅 在 IE 中刷新 javascript location.hash带有片段标识符的Response.Redirect在稍后使用location.hash时会导致意外刷新 了解更多详细信息和一些建议的解决方法。)

Turns out that this is just a variant of a problem that's been long noted, namely, that Internet Explorer refreshes the page when (a) the user has arrived at the current page after a redirect, and (b) you change the window.location.hash. In other words, this is an IE issue (still not fixed in IE9!), not a Silverlight problem. Everything behaves correctly with Firefox and Chrome. (See javascript location.hash refreshing in IE and Response.Redirect with a fragment identifier causes unexpected refresh when later using location.hash for more details, and some suggested workarounds.)

在 Silverlight 中设置 HtmlPage.Window.CurrentBookmark 属性时禁止导航

半城柳色半声笛 2024-11-06 13:41:40

您检查了 pragma 定义的选项吗?例如 http://www.sqlite.org/pragma.html#pragma_synchronous 可能会导致这种行为。

Did you check options defined by pragma? For example http://www.sqlite.org/pragma.html#pragma_synchronous can cause this behavior.

SQLite 数据库连接正在内存中进行更改,但未保存到文件 - AS3 AIR

半城柳色半声笛 2024-11-06 09:40:56

有一种更简单的方法可以使用以下方法绘制您想要的面:

glPushMatrix();

glBegin(GL_QUADS);

//Draw the 16 vertices with their normals.

glEnd();

glPopMatrix();

例如,如果您想要正面:

glPushMatrix();

glBegin(GL_QUADS);

glColor3f(1.0f,1.0f,1.0f);
glNormal3f(0.0,0.0,1.0);
glVertex3f( position[0],  position[1], position[2]);


glNormal3f(0.0,0.0,1.0);
glVertex3f( position1[0], position1[1], position1[2]);


glNormal3f(0.0,0.0,1.0);
glVertex3f(position2[0], position2[1], position2[2]);


glNormal3f(0.0,0.0,1.0);
glVertex3f(position3[0],  position3[1], position3[2]);

glEnd();

glPopMatrix();

在一张纸上画出面,以确定您需要的 position,position1,position2,position3< /代码>等出于通用目的而命名它们,应该很容易确定它们的坐标。


如果你想给它一点灵活性,你可以创建一个 Cube 类,并只渲染你设置了标志的女巫的面。通过使用类,您可以对可渲染对象的显示方式(颜色、位置、比例等)进行大量控制。

There is a much easier way to draw the faces you want by using:

glPushMatrix();

glBegin(GL_QUADS);

//Draw the 16 vertices with their normals.

glEnd();

glPopMatrix();

For example if you want the front:

glPushMatrix();

glBegin(GL_QUADS);

glColor3f(1.0f,1.0f,1.0f);
glNormal3f(0.0,0.0,1.0);
glVertex3f( position[0],  position[1], position[2]);


glNormal3f(0.0,0.0,1.0);
glVertex3f( position1[0], position1[1], position1[2]);


glNormal3f(0.0,0.0,1.0);
glVertex3f(position2[0], position2[1], position2[2]);


glNormal3f(0.0,0.0,1.0);
glVertex3f(position3[0],  position3[1], position3[2]);

glEnd();

glPopMatrix();

Draw the faces on a piece of paper to figure out what values you need for position,position1,position2,position3,etc. Named them so for general purpose, it should be fairly easy to determine their coordinates.


If you want to give it a touch of flexibility you can create a Cube class and render only the faces for witch you have set a flag to be on. By using a class you gain lots of control on how you want your render-able object to be displayed (color,position,scale, etc).

opengl c++ 中的错误代码,可能与cood系统有关

我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文